CS 2650 - Computer Architecture

Assembler Project #1
Due 10 November 2008

Perform the following steps on a PC in DOS.  Be careful to follow the steps exactly so as not to completely erase the hard disk or <worse>!

1.  Download the the NASM Assembler Zip file from the link http://rbhilton.com/wsucs/cs2650/CS2650NASM.ZIP
     This file is a zip file. Extract the files contained in the zip into a common folder, preferably one at the root level of your main drive.
     It will expand into 4 files. These four files will need to be in the same subdirectory as your lab program.
2.  Open Notepad or another text editor.
3.  Key in the basic NASM template as defined below.
4.  Key in Assembler code to:

5.  Save your program as CS2650P1.ASM to the same folder as NASMW.EXE and EXEBIN.MAC
6.  Assemble your program by typing at the command line:  NASMW   CS2650P1.ASM   -oCS2650P1.COM
7.  If you have errors on compile, correct them and then reassemble as in #6
8.  Thoroughly test your program before submitting it.
9.  Upload your program source (CS2650P1.ASM) and your executable (CS2650P1.COM) using the Web Uploader. The files will need to be uploaded prior to class on the due date.



 Int 10h  Function 6  Scroll window area

Input Registers
 AH  06h
 AL  Number of lines to scroll (if zero, entire windows is blanked)
 BH  Attribute used for blanked area (Attribute byte defined below)
 CH  Row, upper left corner
 CL  Column, upper left corner
 DH  Row, lower right corner
 DL  Column, Lower right corner

Output Registers
 None

This function initializes a window to blank with a specified attribute or scrolls the window up a specified number of lines.  The scroll function moves all lines in the window up one line, adds a blank line (with the designated attribute) at the bottom of the window, and eliminates the line that previously was at the top of the window. Defining the window as the entire screen provides for clearing the screen.



Int 10h  Function 13h Write ASCII string

Input Registers
 AH  13h
 AL  Write mode   Use 00h
 BH  Video Page  Use 00h
 BL  Attribute byte  (Attribute byte defined below)
 CX  Length of String
 DH  Row at which to write string
 DL  Column at which to write string
 ES:BP Pointer to string

Output Registers
 None



NASM Template

;BART SIMPSON CS2650 Assembler Program #1
[BITS 16]               ;Set code generation to 16 bit mode
%include 'exebin.mac'
EXE_Begin
[ORG 100H]  ;set addressing to begin at 100H

;your program code goes here

EXE_End


Attribute Byte breakdown

Bit 0 - Blue component of foreground color
Bit 1 - Green component of foreground color
Bit 2 - Red component of foreground color
Bit 3 - Intensity component of foreground color
Bit 4 - Blue component of background color
Bit 5 - Green component of background color
Bit 6 - Red component of background color
Bit 7 - Intensity component of background color