0% found this document useful (0 votes)
7 views

CS401 Assignment 2

CS401 Assignment 2

Uploaded by

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

CS401 Assignment 2

CS401 Assignment 2

Uploaded by

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

Assembly Language Code:

[org 0x0100]

jmp start

message: db 'BC220421085'

length: dw 11

clrscr:

push es

push ax

push di

mov ax, 0xb800

mov es, ax

mov di, 0

nextloc:

mov word[es:di], 0x2020

add di, 2

cmp di, 4000

jne nextloc

mov si, message

mov cx, [length]

mov di, 79

sub di, cx

shl di, 1

mov ax, 3

mov bx, ax

shl bx, 60

shl ax, 2

add bx, ax

add di, bx

shl di, 1
print_vuid:

mov al, [si]

mov ah, 0x05

mov [es:di], ax

add si, 1

add di, 2

loop print_vuid

pop di

pop ax

pop es

ret

printstr:

push bp

mov bp, sp

push es

push ax

push cx

push si

push di

mov ax, 0xb800

mov es, ax

mov si, [bp+8]

mov cx, [bp+10]

mov di, [bp+4]

mov ax, [bp+6]

mov bx, ax

shl bx, 6

shl ax, 2
add bx, ax

add di, bx

shl di, 1

print_loop:

mov al, [si]

mov ah, [bp+12]

mov [es:di], ax

add si, 1

add di, 2

loop print_loop

pop di

pop si

pop cx

pop ax

pop es

pop bp

ret 10

start:

call clrscr

mov ax, 7

push ax

mov ax, 4

push ax

mov ax, 5

push ax

mov ax, message

push ax

push word (length

call printst
mov ax, 0x4c00

int 0x21

Output:

You might also like