Sprotne naloge 10
Zahteve zaključka
Rok za oddajo: ponedeljek, 20. januar 2025, 23.56
1. Rezervirajte prostor za tabelo osmih 8-bitnih elementov. Nato v programski zanki vse elemente postavite na FF(16).
Namig: Uporabite posredno naslavljanje brez odmika. Bazni register usmerite na začetek tabele in ga v zanki povečujte. V vsakem obhodu zanke v trenutni element vpišite FF(16).
2. Podana je tabela 10 predznačenih števil:
TABELA: .byte 192,155,224,48,0,128,99,147,177,100
Napišite program, ki sešteje vsa števila v tabeli in zapiše rezultat v 16-bitno spremenljivko REZULTAT. Program naj tudi prešteje vsa števila večja od 100. Rezultat preštevanja naj bo na koncu izvajanja programa v registru R1.
Kaj je potrebno spremeniti, če so elementi tabele 16-bitna števila in je REZULTAT 32-bitna spremenljivka?
3. Napišite program, ki prešteje število presledkov v nizu "Zunaj je mraz, sneg in poledica.", ki je zaključen z ničlo. Rezultat naj bo v R1.
4. Podana je tabela, v kateri je 14 16-bitnih vrednosti:
TABELA: .hword 1,100,-255,24,-88,31,56,192,155,-224,0,101,-199,47
Napišite program, ki v zanki vse elemente tabele, ki so večji ali enaki -100 in manjši od 100 postavi na 0.
---------------------------------------------------------------------------------------------
1. Reserve the memory space for a table of eight 8-bit elements. Then in the program loop, set all the elements to the value of FF(16).
Tip: Use indirect addressing without offset. Point the base register to the beginning of the table and increase it in the loop. At every repetition of the loop, write FF(16) into the current element.
2. The following table of 10 signed numbers is given:
TABLE: .byte 192,155,224,48,0,128,99,147,177,100
Write a program that calculates the sum of all numbers in the table and stores the solution to a 16-bit variable RESULT. In addition, count all numbers in the table that are greater than 100 signed. The result should be at the end of the program execution in the R1 register.
What changes if the elements of the table are 16-bit numbers, and RESULT is a 32-bit variable?
3. Write a program in assembly language that counts the number of spaces in a string "Outside is cold, wet and slippery.", terminated by zero. Result should be in R1 register.
4. A table is given with 14 16-bit values:
TABELA: .hword 1,100,-255,24,-88,31,56,192,155,-224,0,101,-199,47
Write a program with a loop that sets all table elements that are greater than or equal to -100 and less than 100 to the value of 0.
Namig: Uporabite posredno naslavljanje brez odmika. Bazni register usmerite na začetek tabele in ga v zanki povečujte. V vsakem obhodu zanke v trenutni element vpišite FF(16).
2. Podana je tabela 10 predznačenih števil:
TABELA: .byte 192,155,224,48,0,128,99,147,177,100
Napišite program, ki sešteje vsa števila v tabeli in zapiše rezultat v 16-bitno spremenljivko REZULTAT. Program naj tudi prešteje vsa števila večja od 100. Rezultat preštevanja naj bo na koncu izvajanja programa v registru R1.
Kaj je potrebno spremeniti, če so elementi tabele 16-bitna števila in je REZULTAT 32-bitna spremenljivka?
3. Napišite program, ki prešteje število presledkov v nizu "Zunaj je mraz, sneg in poledica.", ki je zaključen z ničlo. Rezultat naj bo v R1.
4. Podana je tabela, v kateri je 14 16-bitnih vrednosti:
TABELA: .hword 1,100,-255,24,-88,31,56,192,155,-224,0,101,-199,47
Napišite program, ki v zanki vse elemente tabele, ki so večji ali enaki -100 in manjši od 100 postavi na 0.
---------------------------------------------------------------------------------------------
1. Reserve the memory space for a table of eight 8-bit elements. Then in the program loop, set all the elements to the value of FF(16).
Tip: Use indirect addressing without offset. Point the base register to the beginning of the table and increase it in the loop. At every repetition of the loop, write FF(16) into the current element.
2. The following table of 10 signed numbers is given:
TABLE: .byte 192,155,224,48,0,128,99,147,177,100
Write a program that calculates the sum of all numbers in the table and stores the solution to a 16-bit variable RESULT. In addition, count all numbers in the table that are greater than 100 signed. The result should be at the end of the program execution in the R1 register.
What changes if the elements of the table are 16-bit numbers, and RESULT is a 32-bit variable?
3. Write a program in assembly language that counts the number of spaces in a string "Outside is cold, wet and slippery.", terminated by zero. Result should be in R1 register.
4. A table is given with 14 16-bit values:
TABELA: .hword 1,100,-255,24,-88,31,56,192,155,-224,0,101,-199,47
Write a program with a loop that sets all table elements that are greater than or equal to -100 and less than 100 to the value of 0.