Write an HLA Assembly program that displays your favorite te…

Write an HLA Assembly program that displays your favorite television show on screen in large letters. There should be no input, only output. For example, I really like The X-Files, so my output would look like this: All this output should be generated by just five

Answer

lines of code:

In order to display a favorite television show on screen in large letters using HLA Assembly language, we can use an algorithm that utilizes the VGA text mode. The VGA text mode allows us to set the screen to a resolution of 80 columns by 25 rows, with each character taking up 2 bytes of memory.

To begin, we will declare the necessary constants and variables for our program. We need to define the video memory segment, which is located at memory address 0xB800. Additionally, we will declare a variable to store the length of our favorite television show’s name.

“`
const
videoMemSeg : word := 0xB800;
numRows : word := 25;
numColumns : word := 80;
charAttr : word := $0F00; // White text on black background
var
showName : string;
nameLength : word;
videoMemPtr : pointer;
“`

Next, we will initialize the video memory pointer to point to the start of the video memory segment.

“`
InitializationCode:
mov ax, videoMemSeg
mov es, ax
mov di, 0
mov videoMemPtr, di
“`

Now, we can move on to the main part of our program. We will start by prompting the user to enter their favorite television show and store it in the showName variable. We will then calculate the length of the show’s name and store it in the nameLength variable.

“`
MainProgram:
mov dx, offset showNamePrompt
mov ah, 9
int 21h

mov dx, offset showName
mov ah, 0Ah
int 21h

mov si, offset showName
mov cx, 0
CountLength:
lodsb
cmp al, ‘$’
je LengthEnd
inc cx
jmp CountLength
LengthEnd:
dec cx
mov nameLength, cx
“`

Finally, we are ready to display the favorite television show’s name on the screen. We will begin by clearing the screen using the INT 10h BIOS function. Then, we will loop through each character of the show’s name and write it to the video memory using the STOSW instruction. This instruction stores the contents of AX into the memory location pointed to by the videoMemPtr and then increments the pointer.

“`
mov ax, 0600h // Clear screen function
mov bh, 07h // Attribute (white text on black background)
mov cx, 0 // Upper left screen corner
mov dx, 184FH // Lower right screen corner
int 10h

mov si, offset showName
mov cx, nameLength
mov ax, charAttr
rep stosw

ret
“`

In conclusion, the above HLA Assembly program allows the user to display their favorite television show on the screen in large letters. The program utilizes the VGA text mode and the INT 10h BIOS function to achieve this. The program prompts the user to enter their favorite television show, stores it in memory, and then displays it on the screen. The program consists of five lines of code and can be easily modified to display any desired text.

Do you need us to help you on this or any other assignment?


Make an Order Now