0% found this document useful (0 votes)
21 views3 pages

cs401P 100%correct Assignmentsolution Fall2024

This document contains an assembly language program for a computer architecture course, authored by Muhammad Ayaz. It includes a clear structure with functions for clearing the screen and printing a string to the screen. The program initializes a message and displays it with specific formatting on a blue background.

Uploaded by

osamasdesign21
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)
21 views3 pages

cs401P 100%correct Assignmentsolution Fall2024

This document contains an assembly language program for a computer architecture course, authored by Muhammad Ayaz. It includes a clear structure with functions for clearing the screen and printing a string to the screen. The program initializes a message and displays it with specific formatting on a blue background.

Uploaded by

osamasdesign21
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/ 3

Assignment No.

2
Semester: Fall 2024
CS401p Computer Architecture and Assembly Language
Programming
100% correct solution Made by Muhammad Ayaz

Don’t copy paste ready your own solution\

Solution

[org 0x0100]

jmp start

message: db 'BC123456789'
length: dw 11

clrscr:
push es
push ax
push di
mov ax, 0xb800
mov es, ax
mov di, 0

nextloc:
mov word [es:di], 0x1020 ; 0x10 for blue background, 0x20 for space character
add di, 2
cmp di, 4000
jne nextloc

pop di
pop ax
pop es
ret

printstr:
push bp
mov bp, sp
push es
push ax
push cx
push si
push di

MUHAMMAD AYAZ 03429311964


mov ax, 0xb800
mov es, ax
xor ax, 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]

nextchar:
mov al, [si]
mov [es:di], ax
add di, 2
add si, 1
loop nextchar

pop di
pop si
pop cx
pop ax
pop es
pop bp
ret 10

start:
call clrscr
mov ax, 69
push ax
mov ax, 24
push ax
mov ax, 9
push ax
mov ax, message
push ax
push word [length]

call printstr

mov ax, 0x4c00


int 0x21

MUHAMMAD AYAZ 03429311964


MUHAMMAD AYAZ 03429311964

You might also like