Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program negacja;
- #include("stdlib.hhf");
- static
- liczba: int8;
- liczba1: int8;
- begin negacja;
- stdout.put("Podaj liczbe z zakresu od 0 do 127: ");
- stdin.get(liczba);
- //liczba szesnastkowo
- stdout.put(nl, "Szesnastkowo: ");
- stdout.putb(liczba);
- //wyswietla liczbe w postaci hex po inwersji bitow
- mov(liczba,al); //liczba do al
- not(al);
- stdout.put(nl, "Po inwersji bitow: ",al,nl );
- //wyswietla liczbe w postaci hex po inwersji bitow i dodaniu jednosci
- add(1,al);
- stdout.put(nl, "Po dodaniu jednosci: ",al,nl );
- //wyswietla liczbe w postaci dec po inwersji bitow i dodaniu jednosci
- mov(al,liczba1);
- stdout.put("Wynik dziesietnie: ",liczba,nl);
- //wyswietla liczbe w postaci dec w kodzie u2 przy wykorzystaniu instrukcji neg
- stdout.put("Ta sama operacja z wykorzystaniem instrukcji neg: ",nl);
- mov(liczba,al); //liczba do al
- neg(al);
- mov(al,liczba1);
- stdout.put("Wynik szesnastkowo: ",al,nl);
- stdout.put("Wynik dziesietnie: ",liczba1,nl);
- end negacja;
- /////////////////////////////////////////////////////////////////////////
- program rozszerzenie;
- #include("stdlib.hhf");
- static
- jedenbajt: int8;
- dwabajty: int16;
- trzybajty: int32;
- begin rozszerzenie;
- stdout.put("Podaj liczbe calkowita w zakresie 0 do 255: ");
- stdin.get(jedenbajt);
- stdout.put(nl,"Rozszerzanie znakiem (cbw i cwde)",nl);
- mov(jedenbajt, al); //jedenbajt do al;
- stdout.put("Wprowadzono liczbe: ",jedenbajt, "(",al,")H" ,nl);
- cbw(); //rozszerza znakiem bajt z rejestru al na rejestr ax;
- mov(ax,dwabajty); //ax do dwabajty;
- stdout.put("Rozszerzaenie do 16-bitow: ",dwabajty,"(",ax,")H" ,nl);
- cwde(); //rozszerza znakiem slowo z rejestru ax na rejestr eax;
- mov(eax,trzybajty); //eax do trzybajty;
- stdout.put("Rozszerzaenie do 32-bitow: ",trzybajty,"(",eax,")H" ,nl);
- stdout.put(nl,"Rozszerzanie znakiem (movsx)",nl);
- movsx(jedenbajt,ax); //operand docelowy (ted drugi) MUSI BYC REJESTREM
- mov(ax,dwabajty);
- stdout.put("Rozszerzaenie do 16-bitow: ",dwabajty,"(",ax,")H" ,nl);
- movsx(jedenbajt,eax);
- mov(eax,trzybajty);
- stdout.put("Rozszerzaenie do 32-bitow: ",trzybajty,"(",eax,")H" ,nl);
- end rozszerzenie;
- ////////////////////////////////////////////////////////////////////////////////////////
- program male_na_duze;
- #include("stdlib.hhf");
- static
- litera: char;
- begin male_na_duze;
- stdout.put("Podaj litere: ");
- stdin.getc();
- if(al >= 'a') then
- if(al <= 'z') then
- and($5f,al);
- endif;
- endif;
- stdout.put("Podany znak po konwersji na duzy to : ");
- stdout.putc(al);
- stdout.newln();
- end male_na_duze;
- ///////////////////////////////////////////////////////////////////////////////
- program male_na_duze2;
- #include("stdlib.hhf");
- static
- litera: char;
- begin male_na_duze2;
- stdout.put("Podaj litere: ");
- stdin.get(litera);
- if(litera >= 'a') then
- if(litera <= 'z') then
- and($5f,litera);
- endif;
- endif;
- stdout.put("Podany znak po konwersji na duzy to : ",litera);
- stdout.newln();
- end male_na_duze2;
- /////////////////////////////////////////////////////////////////////////////////
- program demo_elon;
- #include("stdlib.hhf");
- begin demo_elon;
- stdout.put("Podaj tekst: ");
- stdin.flushInput();
- repeat
- stdin.getc();
- stdout.putc(al);
- stdout.put(" = ",al,nl);
- until( stdin.eoln() );
- end demo_elon;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement