How a computer processes information
Instruction Code and Assembly Language

Sample Program

A succession of numbers has already been saved at successive memory location somewhere in memory, which represent the characters of a message. The location of the first number has been given the name 'message'. The memory address of 'message', is defined in two parts -a segment 1 of memory and an offset 2 within that segment. A succession of number organised like this is called a string variable.

mov ax, seg message 

'3 Load a value which represents the segment
'of where the variable string message is
'located into register ax

mov ds, ax 

'load the value in register ax into register ds

mov ah, 09 

'Load the value 09 into register ah

lea dx, message 

'Loads the effective address of the string
'message within the segment given by the
'value in the first instruction. The actual 
'beginning memory address of the string
'defined as 'message' has now been given
'the segment register ds and the offset 
'register dx

int 21h 

'This causes an interrupt 4 to the processor, 
'which runs the routine 21h, which places
'each value in the successive memory
'locations from 'message' onto the screen
'until the value of the character '$' is 
'reached, where it stops.

The program is typed into an assembler 5 program, an application program which runs on the computer being used. Several other sections will be added to the sample program that instruct the assembler program how to make the program into the numbers the CPU can cope with. The assembler program is then instructed to compile (converts) the written code, as above, into a list of instructions that can be understood by the computer which will display the characters of ‘message’ on the screen.

  1. Segment -The total memory of the PC is divided into 64KB sections, each section is called a segment. The segment can be defined in one byte.
     
  2. Offset -The offset is a specific memory location within the segment. The combination of segment and offset is used to specify a specific memory location. The principle of Segment Addressing is beyond the scope of this course and is covered on the IT Systems Support Professional course.
     
  3. Most programming languages have a comment structure for describing what each line does. Very often it can be placed on the same line but separated with a specific character -' or # or others.
     
  4. Interrupt -This is something which physically stops what the CPU is doing and sends it to a set of instructions which carry out a particular function.
     
  5. An assembler program allows the programmer to input the assembly language (mnemonics etc.) and converts it to machine code (a list of numbers that the CPU can understand, instructions that can be understood by the computer which will display the characters of 'message' on the screen.