Assembly Language: Easy Math

This section explains some of the basics of doing math in Assembly language. There are several hardware and software tricks that can be used to perform math calculations as quickly as possible. This section discusses bit level multiplication with shifts and adds. Continue reading “Assembly Language: Easy Math”

Advertisements

Assembly Language: Video Character Interface

This section has a set of code examples for writing character data to a PC in 80 character by 25 line mode. The first routine will check the video mode, and if it is a standard mode, the code returns with a no carry condition and starts using the standard video BIOS routines to perform the requested functions. These routines provide many code entry points where other programs may call in. Before using any of the video routines, the program must call the reset_video routine to initialize and make ready the other video calls. Some of the video display routines will respond to video display escape codes. Most of the escape codes deal with standard cursor control functions. There is an example of table selection jumping code.

Most computers use a raster graphics video system. The data is sent to the monitor as rows from left to right that are arranged from top to bottom. The first data bit sent goes to the upper left corner and the last data bit in a frame goes to the lower right corner. When addressing video RAM, the memory may be divided into rows that can be divided into columns. A fundamental understanding of this system is necessary when translating a row and column position into the actual video RAM address for a character or pixel location.

Continue reading “Assembly Language: Video Character Interface”

Assembly Language: How to Make Sounds example

This code example provides a set of keyboard routines to control sound output while waiting for a user to enter a keyboard character. The advantage to this method is that a main routine can call these sound routines to play a sound sequence, and the sound routines will return control back to the main routine whenever the user enters keyboard data so that the main routine can continue computing while the sound plays in the background. The code example has two different code entry points for getting keyboard data. One code entry point is a standard get_keyinput call which will wait for a key and update the sound data until a key code is found. The other code entry point is the get_keyinput_to call, which will wait a set amount of time for a key code and if none is found, return with a no key code found condition. The calling routine puts a timeout counter value in register AX on entry. The counter value is based on the system clock which ticks at 18.2 times per second. The entry point start_table_sound is used to begin a background sound sequence. On entry, the register BX indexes a table of sound data. The table has a format of four byte entries and is terminated by a data word of zero. The four bytes are used as two words: the first is a duration count and the second is a tone value. There are two code entry points for turning the background sound off and on. There is also a utility to flush out the keyboard buffer that can be executed with a call to flush_keyboard. Continue reading “Assembly Language: How to Make Sounds example”

Assembly Language: Simple IO Program

The following example illustrates a simple program that gets keyboard input from a user, adds two numbers together, and displays output to the standard video output. This routine uses three basic DOS calls: the DOS function 1 (StdConInput) for input, the DOS function 2 (StdConOutput) for output, and the DOS function 4CH (Exit) to terminate the routine. This routine gets two single-digit numbers from a user, then adds the numbers together and displays the results. The routine continues to operate until the user enters a keyboard character that is not a number.

Continue reading “Assembly Language: Simple IO Program”

An Introduction To Interrupts P2

Describe the problems associated with the timing of interrupts with respect to.

  1. Software Events

    The problem with interrupts is that their occurrence cannot be predicted. They could occur at any time. Critical code portions should be protected by disabling
    interrupts for their duration. A typical example is accessing shared data.The use of interrupts can affect the timing of existing coded routines. This effect
    is unpredictable, due to the nature of interrupts. Code which is heavily timing dependent may not work when interrupts are enabled. These timing critical portions need to be protected also.

    The processing of interrupts should be kept as short as possible, with reguard to the duration of the software event in question.

Continue reading “An Introduction To Interrupts P2”

An Introduction to Interrupts

An interrupt is an unexpected hardware initiated subroutine call or jump that temporarily suspends the running of the current program.
Interrupts occur when a peripheral device asserts an interrupt input pin of the micro-processor. Provided the interrupt is permitted, it will be acknowledged by the processor at the end of the current memory cycle. The processor then services the interrupt by branching to a special service routine written to handle that particular interrupt. Upon servicing the device, the processor is then instructed to continue with what is was doing previously (by use of a special “return from interrupt” instruction).
Interrupts fall into two major categories, maskable and non-maskable. Continue reading “An Introduction to Interrupts”

Assembly Language Programming – Program management tools

These tools are designed to make the process of maintaining programs easier.

MAKE

This utility is designed to ease updating of programs, especially multiple module programs.

It works by using a list of dependencies. These dependencies illustrate the relationship between the source, include, object and executable versions of the program.

Continue reading “Assembly Language Programming – Program management tools”