Question: Assembly Language Coding Problems using the alphabet? Please help. Thanks. Assemble, link, and run the printAlpha.s (shown at bottom) assembly language program using the following
Assembly Language Coding Problems using the alphabet? Please help. Thanks.
Assemble, link, and run the "printAlpha.s" (shown at bottom) assembly language program using the following steps:
1) as printAlpha.s -o printAlpha.o 2) gcc printAlpha.o 3) ./a.out
The program prints the alphabetical characters from 'a' to 'z' on one line as follows:
| $ ./a.out abcdefghijklmnopqrstuvwxyz $ |
Make 2 copies of the printAlpha.s file, and call them mountainTerrain.s, and triangle.s
PROBLEMS:
Problem 1: Edit the mountainTerrain.s file and change the code to alternature between upper and lower case characters while printing the alphabet. The output should be as follows:
| $ ./a.out AbCdEfGhIjKlMnOpQrStUvWxYz $ |
Problem 2: Edit the triangle.s file and change the code to print a triangle using lower case characters. The output should be as follows:
| $ ./a.out abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxy abcdefghijklmnopqrstuvwx abcdefghijklmnopqrstuvw abcdefghijklmnopqrstuv abcdefghijklmnopqrstu abcdefghijklmnopqrst abcdefghijklmnopqrs abcdefghijklmnopqr abcdefghijklmnopq abcdefghijklmnop abcdefghijklmno abcdefghijklmn abcdefghijklm abcdefghijkl abcdefghijk abcdefghij abcdefghi abcdefgh abcdefg abcdef abcde abcd abc ab a $ |
printAlpha.s file: 
printAlpha.s file in text format:
.intel_syntax noprefix .data n1: .int 97 n2: .int 122
.text .globl main
main: mov ebx, DWORD PTR n1 loop: cmp ebx, DWORD PTR n2 jg end mov edi, ebx call putchar inc ebx jmp loop end: mov edi, 10 call putchar mov eax, 0 ret
.intel syntax noprefix .data 97 4 5 n2: 6 7 8 .int .int 122 .text .globl main 11 main:mov 12 loopmp 13 mov call inc mp mov call mov ret ebx, DWORD PTR nl ebx, DWORD PTR n2 end edi, ebx putchar ebx loop edi, 10 putchar eax, 0 17 18 end: 19 20 21
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
