Sei sulla pagina 1di 36

System Programming

BSE-5,BCE-5
By Rashid Karim Bahria University , Islamabad

Introduction
Some Questions: (Back ground) - can you describe general architecture of a computer what are its main components ? - can you describe how a program is executed by a computer ? - do you know about intel family of processors ? - How many large programs have you written (describe) ?

To be a good programmer
You should be creative , imaginative. Should be very attentive , disciplined. Should pay attention to detail. Should try to design on paper first then code. Should use pseudo language , flow chart. Should use Top down approach.

Objectives of this course


To enable you to use low level programming to : access devices i.e. hardware attached to the system. : to use low level programming to write efficient code. : to use Operating System calls. Why ? (because you are a computer engineer not a computer end user).

Learning Outcome
You will learn intel assembly language. You will learn how to write assembly programs You will learn how to use debugger. You will learn what specific hardware knowledge is required to write assembly programs You will learn how to use OS system calls You will apply the above acquired know how to create some useful System Programs.

We will do this in phases


Phase 1.Our aim will be to Learn - architecture related stuff and - assembly syntax. (before midterm) Phase 2. Our aim will be to write simple programs. (before midterm) Phase 3. Our aim will be to design larger programs. (after midterm)

How we do this ?
(week 1, lecture 1) We review Architecture related knowledge. - registers - name / use - size - address bus size - memory organization - segmented model - flat model

Week1 lab 1
Dos user interface commands - dir, path , cd - debug - debug commands a, r, d, u, etc - understanding memory dump - hex number basics - memory concepts

week 2,lecture 2
We learn how data is organized in memory. little endian vs big endian We learn how data is accessed from memory in segmented model Physical , logical address

Week 2 , lab 2
We feed some data and instructions using debug commands. - use db, dw for data and text. We trace through a simple program. Emphasis on data size and register used You write some more programs. We introduce loop structure.

week 3, lecture 3
We learn Addressing modes - direct - indirect - relative - base + index - base + index + offset What registers are allowed

Week 3,lab 3
We practice addressing modes using an example program using debugger. You write some more programs. We emphasize on correct instruction correct addressing modes through an exercise.

week 4,lecture 4
Useful Instruction set Simple program We introduce MASM and tiny program skeleton. Simple program execution trace step by step.

Week 4, lab 4
We introduce MASM and tiny program skeleton. We write/run some programs using MASM and trace them in debugger. We introduce DOS int 21 for some I/o You solve some more programs.

week 5,lecture 5
We learn some useful decision making intel instructions And use them in a sample program

Week 5, lab 5
We use decision making intel instructions and use them in a sample program. We ask you to write your own programs. We write some interactive program using DOS int 21 service.

week 6,lecture 6
Learn about Assembly language directives. Procedures are introduced. Write some procedures and go through them.

Week 6, lab 6.
You write some procedures using masm and debug using debug.

week 7,lecture 7
Parameter passing to procedures. Built-in library procedures.

Week 7, lab 7
Learn how to use Library procedures.

Week 8, lecture 8
Parameter passing using stack.

Week 8 , lab 8
Parameter passing using stack. Tracing recursive procedure.

Week 9, lecture 9
Key board handling services Mouse handling services Screen handling services.

Week 9 ,lab 9
Programs using: Key board handling services Mouse handling services Screen handling services.

Week 10. lecture 10


Hard Disk, sector , track , etc Boot sector , record File System (FAT, FAT32) File handling services.

Week 10. lab 10


Programs using: File handling services.

Week 11, lecture 11


Writing your own interrupt service routines. What is TSR

Week 11, lab 11


Writing interrupt sevice routines. Writing TSRs

Week 12, lecture 12


Access Serial Port under DOS Access Parallel Port under DOS

Week 13, Lecture 13


Device drivers in DOS A device driver for serial port

Week 14
Access hardware under Windows 98

Week 15
Revise some old stuff

Week 16
Project demo

This course will give you ability to understand any Micro Processor or Micro Controller from programmers point of view And you be able to work on them. There are a lot of applications of these in industry where you need to do low level programming.

Books
1. Assembly Language for Intel-Based Computers. by Kip R. Irvine.

2. The 8088 and 8086 Microprocessors


Programming , Interfacing, Software, Hardware, and Applications. 2nd Edition. by: Walter A. Triebel , Avtar Singh

Book
Art of Assembly Language Programming by Randall Hyde ebook downloadable from the internet. Any Good Tutorial on Assembly Language.

Potrebbero piacerti anche