Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.
- program tablica;
- #include("stdlib.hhf");
- static
- tablica1: int32[10]:=[0,1,2,3,4,5,6,7,8,9]; // liczby sa 1-bitowe wiec trzeba
- tablica2: int8[10]:=[0,1,2,3,4,5,6,7,8,9]; // je domnozyc zeby byly 4bitowe (jak 32)
- wybor: int32; // lub 2bitowe (jak 16)
- begin tablica;
- stdout.put("Podaj indeks elementu ktory chcesz wyswietlic", nl);
- stdin.get(wybor);
- mov(wybor,eax); // zawsze rejestr rozszerzony
- stdout.put("Wartosc z 1 tablicy: ", tablica1[eax*4], nl);
- stdout.put("Wartosc z 2 tablicy: ", tablica2[eax], nl);
- end tablica;
- 2. ale dziala na dobre slowo
- program mnozenie;
- #include("stdlib.hhf");
- static
- a: int8:= 8;
- begin mnozenie;
- mov(a,al);
- shl(4,al); //przemnaza 8 razy 2 do potegi podanej na pierwszym miejscu shl
- mov(al,a);
- stdout.put(a, nl);
- mov(a,al);
- shr(1,al);
- mov(al,a);
- stdout.put(a, nl);
- end mnozenie;
- 3. Tablica dwuwymiarowa
- program dwutablica;
- #include("stdlib.hhf");
- static
- tablica1: int32[1,4,8]:=[1,2,3,4,5,6,7,8,
- 9,10,11,12,13,14,15,16,
- 17,18,19,20,21,22,23,24,
- 25,26,27,28,29,30,31,32];
- kolumna: int32;
- wiersz: int32;
- c: int32;
- begin dwutablica;
- stdout.put("Podaj kolumne ktora chcesz wyswietlic", nl);
- stdin.get(kolumna);
- dec(kolumna);
- stdout.put("Podaj wiersz ktory chcesz wyswietlic", nl);
- stdin.get(wiersz);
- dec(wiersz);
- mov(wiersz, eax);
- intmul(8, eax);
- add(kolumna, eax);
- stdout.put(" Wybrany element ma wartosc: ", tablica1[eax*4], nl);
- end dwutablica;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement