Mac-1 Pseudocode

[ Main Page | Pseudocode | Source Code | Sample Output ]

Define Variables
Define instruction set in hash array

Pass 1 {
	Open input file
	While not end of file {
		Read line
		See if it's a label name
		If it is, put it in the list of labels
		Store it's position too (label destination)
		Increment instruction location counter (ILC)
	}
	Close input file
}

Pass 2 {
	Open input and output files
	While not end of file {
		Read instruction, variable
		verify format/syntax
		if instruction is a symbol being defined, { do it }
  		else {
		convert instruction to binary
		if variable {
			if variable is a label {
				get label's binary value
			} else {
				convert variable to binary
			}
			append to instruction binary
		}
		append instruction to output file
	}
	close input/output file
}

[ Main Page | Pseudocode | Source Code | Sample Output ]

 


Last modified: Wednesday, 05-Mar-2003 23:41:35 EST