Domača naloga - Homework

Rok za oddajo: nedelja, 16. januar 2022, 23.55

Vaš prijatelj Frodo je prejel pomembno sporočilo od čarodeja Gandalfa. Ker pa na vsakem koraku opreza zlobni Saruman, je to sporočilo kriptirano. Ker ročno dešifriranje takšnih sporočil terja veliko časa, se je Frodo odločil, da bo napisal program. Ker Frodo ni vešč v programiranju, je za pomoč prosil vas. Pomagajte Frodu in napišite program v zbirnem jeziku za procesor ARM, ki bo dešifriral prejeto kriptirano sporočilo.     

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?

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.


Your friend Frodo received an important message from Gandalf, the wizard. Since the evil Saruman can be eavesdropping, Gandalf encrypted this message. Decoding encrypted messages by hand takes a long time. For this reason, Frodo decided to write a program. Because Frodo is not very skilled in programming, he asked for your help. Help Frodo and write a program in assembly language for the ARM processor that will decrypt the given encrypted message.      

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?     

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.


Ogrodje programa ("Program Framework"):

.text

NIZ1:              .asciz "yxem Nx yzcdxo, am knxfx Vcjs, Gbnnws rx ejnm nj Zxcj."    
SEZNAM1:      .asciz  "xfjrmansobyzcdwke"    

SEZNAM2:      .asciz  "adegiklmnoprstuvz"             

                       .align
                       .global __start

__start:

                        @Tu napisi program ("Your code here")

__end:               b __end