Download Programming from the Ground Up

Transcript
Table of Contents
1. Introduction........................................................................................................1
Welcome to Programming ...............................................................................1
Your Tools ........................................................................................................3
2. Computer Architecture .....................................................................................7
Structure of Computer Memory.......................................................................7
The CPU...........................................................................................................9
Some Terms ...................................................................................................11
Interpreting Memory......................................................................................13
Data Accessing Methods................................................................................14
Review ...........................................................................................................16
3. Your First Programs ........................................................................................19
Entering in the Program .................................................................................19
Outline of an Assembly Language Program..................................................22
Planning the Program.....................................................................................28
Finding a Maximum Value.............................................................................31
Addressing Modes .........................................................................................41
Review ...........................................................................................................45
4. All About Functions.........................................................................................49
Dealing with Complexity...............................................................................49
How Functions Work .....................................................................................50
Assembly-Language Functions using the C Calling Convention ..................52
A Function Example ......................................................................................59
Recursive Functions.......................................................................................64
Review ...........................................................................................................71
5. Dealing with Files.............................................................................................75
The UNIX File Concept.................................................................................75
Buffers and .bss ...........................................................................................76
Standard and Special Files .............................................................................78
Using Files in a Program................................................................................79
iii