Assembly Language – Interfacing to Hill Routines


There are times that high level languages need to call assembly language modules. This results due to constraints like speed and memory space.

We shall look at interfacing a Pascal program to an assembly language module.

The Pascal program will declare an integer based array, and pass the address of this array, and the number of elements in the array, to an assembly language module. Continue reading “Assembly Language – Interfacing to Hill Routines”


Compiling and executing assembly language programs

This section discusses the basics of generating an executable file from an Assembly language source code file. There is also a discussion of the compiler options of conditional assembly and macros.

With the older versions of Microsoft Assemblers, there are two basic steps used to generate an executable file to run under DOS. The first step is to compile the Assembly language source code into an object file. The second step is to link the object file with any other object files necessary and any needed library routines to generate the executable file. With the new version of Microsoft Assembler, you can compile and link with a single command. Continue reading “Compiling and executing assembly language programs”

Assembly Language Programming – 16 bit processing

[8086] In the code examples so far, we have separated out the coded instructions from the data. Modern processors like the 8088 have separate registers which deal with each section of a program.

	CS and IP = instructions
	DS, BX, SI= data 
	ES, BX, DI= extra data 
	SS, SP, BP= stack

In writing programs for modern processors like the 8088, the program is structured with a minimum of three sections, called SEGMENTS. The three segments represent the CODE, DATA and STACK areas of the program. Information within each segment is accessed differently depending upon the segment type. To access data in the stack segment requires the use of the SS, SP and or BP registers. The following diagrams illustrates how information in the stack and data segments are accessed.


Special assembler directives are used to specify the different segments

Continue reading “Assembly Language Programming – 16 bit processing”

Assembly Language: Data Conversions Routines

Computer systems use character based keyboards and displays for inputting and outputting data. Conversion routines are necessary to convert data types to character strings and back again.

Consider the entry from a keyboard of an integer value 276. This represents a three character sequence of ‘2’, ‘7’ and ‘6’. This character sequence will need to be converted into an appropriate 16bit value representing an integer. Also consider displaying the value of a byte as two hex digits. Each nibble must be converted to an ASCII character before displaying on the terminal screen. Continue reading “Assembly Language: Data Conversions Routines”

Assembly Language: Implementation of High level Language Constructs

In High Level Languages such as PASCAL and BASIC, several constructs are available which help to implement programs. You should know how these constructs are implemented in assembly language.The constructs that we will now deal with involve SELECTION and ITERATION. Both types of constructs are implemented using the conditional BRANCH instructions of the processor.

These types of instructions test the state of the various flags of the status register. All variables are memory based. Any manipulation of variables normally involves three steps,

  1. Load the variable into a register
  2. Perform the operation
  3. Store the result back into the variables location

Continue reading “Assembly Language: Implementation of High level Language Constructs”