Domača naloga - Homework

Rok za oddajo: ponedeljek, 16. januar 2023, 23.55

Podani so trije ASCII znakovni nizi: NIZ, SEZNAM1 in SEZNAM2. V zbirniku za procesor ARM napišite program, ki vse male črke znakovnega niza NIZ zamenja na sledeč način. Če je majhna črka niza NIZ v znakovnem nizu SEZNAM1 jo zamenjaj z istoležno veliko črko niza SEZNAM2. Če je vsebina niza SEZNAM1 "abc" in je vsebina niza SEZNAM2 "xyz" moramo vsak znak "a" v nizu NIZ zamenjati z veliko črko "X", vsak znak "b" moramo zamenjati z veliko črko "Y" in vsak znak "c" z veliko črko "Z". Predpostavite lahko, da sta niza SEZNAM1 in SEZNAM2 enake dolžine ter, da vsebujeta samo male črke. Podano je ogrodje programa. Kakšna je vsebina niza NIZ po koncu izvajanja programa? Program preizkusite za naslednje vrednosti seznama NIZ:

-          "Pjisjrmljrcgf h dyljcfm gfdltw dr rjm  gf crphbf Zryrhci!"

-          "lx Dfywsslcs lb kvf ejiofbb ix jfmihlcs Bwsb, kvfc ejisjrmmlcs mwbk yf kvf ejiofbb ix ewkklcs Tvfm lc."

-          "lk'b vrjpnrjf kvrk mrtfb r mrovlcf xrbk. lk'b Sixknrjf kvrk mrtfb A xrbk mrovlcf Suin."

Ogrodje programa ("Program Framework"):

.text

NIZ:     .asciz "ejisjrmljrcgf h dyljcfm gfdltw dr rjm  gf crphbf dryrhci!"    
SEZNAM1:      .asciz  "abcdefghijklmnoprstuvwxyz"    

SEZNAM2:      .asciz  "xsnzpejvortimwcdagklhufby"             

.align
.global _start

_start:

@Tu napisi program ("Your code here")

_end:    b _end


Za program napišite kratko dokumentacijo. Opišite kako vaš algoritem deluje. Napišite, katere registre ste uporabili in čemu služijo (bazni register, register za podatke, števec, ...). Vse skupaj naj bo na eni strani A4. Program in dokumentacijo oddajte v eni zip datoteki na spletni učilnici. Na zagovor prinesite natisnjeno dokumentacijo.


Given are three ASCII strings: NIZ, SEZNAM1, and SEZNAM2. Write a program in assembly language for the ARM processor that replaces all lowercase NIZ letters in the following way. If the lowercase letter of the NIZ string is an element of SEZNAM1, replace it with the uppercase letter of SEZNAM2, which is in the same position as in SEZNAM1. If the content of SEZNAM1 is "abc" and the content of SEZNAM2 is "xyz", then each character "a" in string NIZ must be replaced with a capital letter "X", each character "b" must be replaced with a capital letter "Y" and each character "c" with the capital letter "Z". You can assume that SEZNAM1 and SEZNAM2 contain only lowercase letters and are of the same length. The program framework is given below. What is the content of the string NIZ after the execution of a program? Test your program for next string values of NIZ:     

-          "Pjisjrmljrcgf h dyljcfm gfdltw dr rjm  gf crphbf Zryrhci!"

-          "lx Dfywsslcs lb kvf ejiofbb ix jfmihlcs Bwsb, kvfc ejisjrmmlcs mwbk yf kvf ejiofbb ix ewkklcs Tvfm lc."

-          "lk'b vrjpnrjf kvrk mrtfb r mrovlcf xrbk. lk'b Sixknrjf kvrk mrtfb A xrbk mrovlcf Suin."

Ogrodje programa ("Program Framework"):

.text

NIZ:     .asciz "ejisjrmljrcgf h dyljcfm gfdltw dr rjm  gf crphbf dryrhci!"    
SEZNAM1:      .asciz  "abcdefghijklmnoprstuvwxyz"    

SEZNAM2:      .asciz  "xsnzpejvortimwcdagklhufby"             

.align
.global _start

_start:

@Tu napisi program ("Your code here")

_end:    b _end

Write short documentation for your program. Briefly describe how your algorithm works. Describe the usage of registers and their meaning or role (base register, data register, counter, ...). All this should fit one A4 page. Submit program and documents in one zip file to the online e-classroom. After submission, you have to pass oral defense of your report - bring printed documentation with you.