Video Buffer & Lookup Tables

P#1: Write an assembly language program that clears the display screen. Wait for the user to hit the return key before returning back to DOS.

.stack 100h 
.data 
      video_buffer WORD 0b000h   ; segment address of monochrome video buffer
                   WORD 0h       ; offset within the buffer
                   WORD 2        ; video array element is 2 bytes
                   WORD 25       ; rows = 25
                   WORD 80       ; columns = 80
      normal       WORD 07       ; normal display mode for characters
.code
clear proc far

      ; fill in the logic!!
      ret
clear endp
code  ends
      end clear

Lookup tables are very important in increasing the speed of a program and the cost of space.

P#2: Simulate the following C program segment in assembly language using a lookup table:

for(i=0;i<=1;i++)
  for(j=0;j<=39;j++)
    {
    gotoxy(i,j);
    printf("*");
    }

Remember, the upper left corner is (0,0).

Q#1: What is the starting and ending address of line 1 of the video buffer?

Q#2: What is the starting and ending address of line 2 of the video buffer?

.stack 100h
.data
     lookuphi db 0b0h,0b0h
     lookuplow db 00h, 0ah
.code
fill proc far
     push ds
     sub ax,ax
     push ax

     
     ret
fill endp
code ends
     end fill


©Douglas J. Ryan/ryandj@pacificu.edu