Chapter 15 - BIOS-Level Programming

2D array - is an ordered list of homogeneous data values that are arranged in rows and columns.

Let's look at an arbitrary 2D array with m rows and n columns (m x n 2D array):

Column 1       2        3         4      ...      n
Row1   (1,1)   (1,2)    (1,3)     (1,4)           (1,n)
Row2   (2,1)   (2,2)    (2,3)     (2,4)  ...      (2,n)

Rowm   (m,1)   (m,2)    (m,3)     (m,4)  ...      (m,n)

What we have to do is map this two-dimensional entity into a one-dimensional space. Two mappings exist to do this:

(1) row-major
(2) column-major

Q#1: What does memory look like if this array is mapped by row-major?

Q#2: What does memory look like if this array is mapped by column-major?

Consider an arbitrary array element A[r,c] in A[1..M,1..N] stored in row major order in an M x N dimensioned array. Assume that each element takes S bytes.

Q#3: Were is A[r,c]?

Q#4: If the array is stored in column major order, where is A[r,c] in general?

Text Graphics

A Monochrome Display adapter is a card that contains a video controller and some memory. What is displayed on the screen at any point in time is what is being held in the video buffer. The buffer is 25x80 characters where each character consists of two bytes:

(1) the 8-bit ASCII code of the character
(2) the 8-bit attribute which dictates how the character is displayed

The video controller has circuitry to convert the values in the video buffer into pixels on the display screen. The text mentions that the video controller cycles through the buffer at least 50 times per second which means that the screen is refreshed 50 times per second.

Q#5: Minimally, how many times must the screen be refreshed so that we do not recognize flicker?

Q#6: How many bytes of memory are required for the video buffer?

Q#7: Assume the following picture below:

Q#8: What is the accessing formula for video[r,c] assuming a row-major accessing scheme?

The IBM Monochrome Display and Printer Adapter (MDA) contains 4K (4096 bytes) of RAM with physical addresses B0000H to B0FFFH. The first 4000 bytes is the video buffer (B0000H - B0F9FH).

P#1: Write an assembly language program that prints an '*' in the upper-left hand corner of the display screen. Wait for the user to hit return before returning to DOS.


©Douglas J. Ryan