Title: Experiment 1
1Experiment 1
- COE 205
- Computer Organization Assembly Language
Programming - Term 032
2Outline
- Definition of a program.
- Instruction atomicity.
- Stored-program concept.
- Programming early computers.
- Assembly language.
- Tools.
- Setting up the environment.
- Policy.
3Definition of a Program
- A mix of instructions and data that causes a
machine to perform one or more operations. - An operation has two elements
- ? Instruction(s)
- ? Data
4Instruction Atomicity
- An instruction is atomic.
- ? Indivisible
- ? Non-interruptible operation
- Hardware ensures the non-interruptible execution
of an instruction. - A complex operation is made of simple
instructions. - ? Multiplication
- - AND For 2-bit multiplication
- - Shift
- - Add
5Stored-Program Concept
- Data instructions are stored in the memory.
- Central Processing Unit (CPU) loads instructions
from memory one by one. - Instructions are executed in sequence.
- User interacts with the system via Input/Output
(I/O) devices.
6Programming Early Computers
- Computers were programmed by hand.
- Front panel switches were used to enter
instructions and data into memory. - Each instruction and data element was manually
converted into bit patterns. - ? Bit pattern of an instruction is called a
Machine Instruction. - To enter instruction/data into memory
- ? Address switches were toggled to the correct
address. - ? Next, data switches were toggled.
- ? Finally, write switch was toggled to write the
binary value to the address specified. - Once all instructions and data entered, the RUN
switch was toggled to run the program.
7Major Drawbacks
- Dealing directly with instructions, data, and
addresses in binary format. - Manual conversion into bit patterns.
- ? Slow
- ? Cumbersome
- ? Error-prone
8Major Milestones
- Monitor programs became popular.
- ? Allowed entry of instructions and data via hex
terminals. - Paper tapes and punched cards became popular as
storage methods for programs. - To increase programmer productivity, assembler
(or assembly) language was invented. - ? An assembler takes machine instructions in
human-readable form and translates them into
binary automatically.
9Features of Assembly Language
- Raw binary values were replaced by symbols called
mnemonics. - ? Changes could be made easily and faster.
- Automatic translation into machine language.
- One-to-one mapping to machine language.
10Disadvantages of Assembly Language
- The programmer requires knowledge of the
processor architecture and instruction set. - Programs are machine dependent (Not Portable),
requiring complete rewrites if the processor is
changed. - Many instructions are required to achieve small
tasks (HL vs. LL). - Source programs tend to be large and difficult to
follow.
11Why know Assembly Language?
We do not have to learn assembly language. It is
enough to learn a high-level language, like C or
Java. We can get by fairly well in todays world
without knowing any assembly language.
12Reasons for Learning Assembly Programming
- Knowing an assembly language helps you understand
what is happening inside a computer. - When writing hardware drivers or software for
embedded systems, you will need to code and debug
in assembly language. - Using assembly language lets you control exactly
what happens in your program. - Assembly programs runs fast and conserves memory.
13Tools
- MASM 6.11
- ? Assembling linking
- ConTEXT
- ? Editor
- Code View
- ? Debugger
- XVI32
- ? Hexadecimal editor
14Setting Up the EnvironmentStep 1
- Get the tools and install them on your machine.
- ? For MASM 6.11 ConTEXT, use the setup files
and keep the default options. - ? For XVI32, copy the application program XVI32
into your hard disk. - ? For Code View, it is part of the MASM 6.11
package. It is run by entering CV at the command
prompt.
15Setting Up the EnvironmentStep 2
- Create a new directory on your hard disk and call
it COE 205 Experiments. - For every new experiment, you should have a new
sub-directory in the root directory COE 205
Experiments.
16Setting Up the EnvironmentStep 3
- To be able to open a DOS screen from within
ConTEXT, do the following - 1. From the OPTIONS menu, choose Environment
Options.
172. Choose Execute Keys tab.
183. When you press on the Add button, a dialog box
will appear. Enter asm and press OK.
194. Choose F9 and type C\WINDOWS\system32\cmd.
exe in the Execute field. 5. Press OK.
Now, whenever you want to open a new DOS screen,
press on the F9 button on the keyboard.
20PolicyLab Sessions
- In every session, a programming problem will be
given at the beginning of the lab. - Concepts will be explained while the students are
working on the problem. - How to Prepare
- Try the sample programs in the lab manual.
- Study the related material from your class notes
and textbook.
21PolicyLate Assignments
- You are supposed to finish all programming
assignments in the lab. - If you run out of time, you can send your
assignment to the following email address. - coe205_at_bareed.com
- Deadline is 1 am the next day.
- You lose THREE points for every late assignment.
22PolicyAbsence
- Three unexcused absences lead to a DN grade.
- Official excuse must be presented to the
instructor no later than one week following the
absence. - Cheating is not allowed. Severe measures will be
taken by the instructor.
23PolicyMark Distribution
- Lab weighs 20 of your final grade.
- 10 will be for lab work.
- 10 will be for the project.