Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. (wyświetlić negacje, dodac 666 do 3bajtowego)
- program lab2;
- #include("stdlib.hhf");
- static
- a: int8:= -7;
- b: int16:= -277;
- c: int32:= -66000;
- //d: int32:=666;
- begin lab2;
- mov(0,AL); //0-(-7), 0 do rejestru
- sub(a,AL); // odejmowanie co (a) od czego (AL)
- mov(Al,a); // przeslanie wyniku rejestru do zmiennej a
- mov(0,AX);
- sub(b,AX);
- mov(AX,b);
- mov(0,EAX);
- sub(c,EAX);
- mov(EAX,c);
- stdout.put("Pierwsza zmienna:",a,nl,"Druga zmienna:", b, nl,"Trzecia zmienna:", c,nl);
- add(666,c);
- stdout.put("Po dodaniu wartosci do c:", c, nl);
- end lab2;
- 2. (wyświetlić 10 9 8 itd do 1)
- program chwila;
- #include("stdlib.hhf");
- static
- i: int8:=10;
- begin chwila;
- while(i>0) do
- stdout.put(i:3);
- mov(i,AL);
- sub(1,AL);
- mov(Al, i);
- endwhile;
- end chwila;
- 3. (w 5 kolumnach i 8 wierszach wys od 40 do 1)
- WERSJA FOR + FOR
- program chwila;
- #include("stdlib.hhf");
- static
- i: int8:=1;
- j: int8:=1;
- x: int8:=40;
- begin chwila;
- for(mov(j,AH); j<=8; inc(j)) do
- for(mov(i,AL); i<=5; inc(i)) do
- stdout.put(x:3);
- dec(x);
- endfor;
- mov(1,i);
- stdout.newln();
- endfor;
- end chwila;
- WERSJA WHILE + FOR
- program chwila2;
- #include("stdlib.hhf");
- static
- zmienna: int8;
- licznik: int8;
- begin chwila2;
- mov(40,zmienna);
- while(zmienna>0) do //
- for(mov(1,licznik); licznik<=5; inc(licznik)) do
- stdout.put(zmienna:3);
- sub(1,zmienna);
- endfor;
- stdout.newln();
- endwhile;
- end chwila2;
- WERSKA WHILE + IF
- program chwila2;
- #include("stdlib.hhf");
- static
- zmienna: int8;
- licznik: int8;
- begin chwila2;
- mov(40,zmienna);
- while(zmienna>0) do
- if(licznik <5) then
- stdout.put(zmienna:3);
- sub(1,zmienna);
- inc(licznik);
- else
- mov(0,licznik);
- stdout.newln();
- endif;
- endwhile;
- end chwila2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement