Sprotne naloge 6

Rok za oddajo: nedelja, 11. december 2022, 23.55
1. Napišite zaporedje ukazov v zbirniku za procesor ARM, ki v register najprej naloži vrednost 0 – uporabite takojšnje naslavljanje. Kakšno je stanje zastavic Z in N po tem ukazu? Zakaj?
Nato naj program registru odšteje vrednost 1. Kakšna je vrednost registra, če predstavlja nepredznačeno / predznačeno število? Kakšno je stanje zastavic Z, C, V in N po tem ukazu? Zakaj?
Nato naj program registru prišteje vrednost 2. Kakšno je stanje zastavic Z, C, V in N po tem ukazu? Zakaj?
Kakšna je končna vrednost registra, če predstavlja nepredznačeno / predznačeno število?

2. Napišite zaporedje ukazov v zbirniku za procesor ARM, ki s pomočjo ALE ukaza v register najprej naloži vrednost 1. Kakšni vrednosti imata zastavici Z in N po tem ukazu? Zakaj?
Nato naj program odšteje od registra vrednost 1. Kakšne vrednosti imajo zastavice Z, C, V in N po tem ukazu? Zakaj?
Nato naj program še enkrat odšteje vrednost 1 od registra. Kakšne vrednosti imajo zastavice Z, C, V in N po tem ukazu? Zakaj?
Kakšna je končna vrednost registra, če predstavlja nepredznačeno / predznačeno število?

3. Napišite zaporedje ukazov v zbirniku za procesor ARM, ki izračuna izraz STEV1 = STEV2 + STEV3 – STEV1, pri čemer je STEV1 16-bitna predznačena spremenljivka, STEV2 in STEV3 pa 8-bitni predznačeni spremenljivki z začetnimi vrednostmi (določite jih z direktivami): STEV1 = -10(10), STEV2 = 64(16), STEV3 = -2(10). Preverite pravilnost rezultata!

--------------------------------------------------------------------------------------------
1. Write a sequence of instructions in assembler for the ARM processor that first loads the value 0 into the register - use immediate addressing. What is the state of the Z and N flags after this instruction? Why?
Then your program should subtract the value 1 from the register. What is the value of the register if it represents an unsigned/signed number? What is the state of the Z, C, V and N flags after this instruction? Why?
Then the program should add the value 2 to the register. What is the state of the Z, C, V and N flags according after this instruction? Why?
What is the final value of the register if it represents an unsigned/unsigned number?

2. Write a sequence of instructions in assembler for the ARM processor which first loads the value 1 into the register using the ALU instruction. What are values ​​of the Z and N flags after thisinstruction? Why?
Then let the program subtract the value 1 from the register. What are values of the Z, C, V, and N flags after this instruction? Why?
The program should then subtract value 1 from the register again. What are values of the Z, C, V, and N flags after this instruction? Why?
What is the final value of the register if it represents an unsigned/unsigned number?

3. Write a sequence of instructions in assembler for the ARM processor that computes the expression STEV1 = STEV2 + STEV3 - STEV1, where STEV1 is a 16-bit signed variable and STEV2 and STEV3 are 8-bit signed variables with initial values ​​(specify them with directives) : STEV1 = -10 (10), STEV2 = 64 (16), STEV3 = -2 (10). Check the correctness of the result!