CSE306
Processing Systems and Structures
J. W. Lockwood,
Lecture 6
Todays Topics
In-class Examples
Program Organization
Assembly and Debugging Techniques
MASM Directives
MP Grading
In class examples
Building Programs
Object: Dependencies
Action
NMAKE
to build programs
NMAKE CLEAN
to remove OBJ, MAP, LST, EXE
Building Programs
Assembling with MASM
Linking
The code segment
Allocating Variables
CodeView Debugger
Using symbolic reference
Setting Breakpoints
Saving your source code
Program Organization
Write pseudocode on paper first to get a clear concept of program control flow and data structures
Break the total program into logical procedures/macros
Use jumps, loops, etc. where appropriate
Use descriptive names for variables
noun_type for types
nouns for variables
verbs for procedures/functions
Assembly Debugging Techniques
General Techniques
Good program organization helps
Programs don't work the first time
Don't give up!
Divide and Conquer Strategy to find problems
Use DEBUG breakpoints to check program progress
Use COMMENT and ; to temporarily remove sections of code
"print" statments announce milestones in program
Test values/cases
Try forcing registers/variables to test output of a procedure
Use "print" statements to display critical data
Double-check your own logic (Did you miss a special case?)
Try a different algorithm, if all else fails...
CSE306 MP Grading Procedure
Functionality: 70% - The program must work.
Comments: 10% - The TAs must be able to understand your program.
Style: 10% - No spaghetti code.
I/O Specific: 5% - Subroutines follow required interface
Modularity: 5% - Appropriate use of procedures and loops