Assembly Language

Practical One

due date : 4pm 27 February 1996

Type out the three sample programs above.

Assembler and Link them using Turbo Assembler (TASM) and Turbo Linker (TLINK).

Run the programs to see if they execute properly. Debug if necessary.

Note: The first program creates no output but a screen-dump after the program has run must still be produced.

Submit the source files, executable files and screen dumps for the all three questions.

Read the notes for details on these programs.

Sample Assembler Program #1

DOSSEG
.MODEL TINY
.STACK

.DATA

.CODE
ProgramStart:
mov ah,4ch ; end program
int 21h
END ProgramStart

Sample Assembler Program #2

; sample02
; illustrates standard output interrupt
DOSSEG
.MODEL SMALL
.STACK

.DATA
aString db 'Hello World',13,10,'$'

.CODE
ProgramStart:
mov ax,SEG _DATA ; set data segment
mov ds,ax

mov ah,09h ; output message
mov dx,OFFSET aString
int 21h

mov ah,4ch ; terminate program
int 21h
END ProgramStart

Sample Assembler Program #3

; sample03
; illustrates setting of BIOS variable
; clears the NUMLock, CAPSLock, SCROLLLock flags
DOSSEG
.MODEL SMALL
.STACK

.DATA
aString db 'Lock keys reset !',13,10,'$'

.CODE
ProgramStart:
mov ax,SEG _DATA ; set data segment
mov ds,ax

mov ax,0040h ; set ES to point to BIOS Data Area
mov es,ax
mov byte ptr es:[0017h],0 ; reset keyboard flags

mov ah,09h ; output message
mov dx,OFFSET aString
int 21h

mov ah,4ch ; terminate program
int 21h
END ProgramStart