0% found this document useful (0 votes)
730 views4 pages

Assignment 2 Solution File cs401P

The document contains assembly code that clears the screen, prints two strings to the screen, and exits. It defines labels and data for clearing the screen, printing strings, and the main start label. The start label calls the clrscr function, pushes data and calls Pri_Str twice to print two different strings to the screen, and exits the program.

Uploaded by

fecem12298
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
730 views4 pages

Assignment 2 Solution File cs401P

The document contains assembly code that clears the screen, prints two strings to the screen, and exits. It defines labels and data for clearing the screen, printing strings, and the main start label. The start label calls the clrscr function, pushes data and calls Pri_Str twice to print two different strings to the screen, and exits the program.

Uploaded by

fecem12298
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

[org 0x0100]

jmp start

Length: dw 11

A_ID: db 'bc1111'

B_ID: db '22222'

Length1: dw 6

Length2: dw 5

clrscr : push es

push ax

push cx

push di

mov ax, 0xb800

mov es, ax

xor di, di

mov ax, 0x0720

mov cx, 2000

cld

rep stosw

pop di

pop cx

pop ax

pop es

ret

Pri_Str: push bp

mov bp, sp
push es

push ax

push cx

push si

push di

mov ax, 0xb800

mov es, ax

mov al, 80

mul byte [bp+10]

add ax, [bp+12]

shl ax, 1

mov di, ax

mov si, [bp+6]

mov cx, [bp+4]

mov ah, [bp+8]

cld

nextchar: lodsb

stosw

loop nextchar

pop di

pop si

pop cx

pop ax

pop es

pop bp
ret 10

start: call clrscr

mov ax , 40

push ax

mov ax,12

push ax

mov ax, 2h

push ax

mov ax, A_ID

push ax

push word [Length1]

call Pri_Str

mov ax, 46

push ax

mov ax,12

push ax

mov ax, 4h

push ax

mov ax, B_ID

push ax

push word [Length2]

call Pri_Str

int 0x20

You might also like