mikolajmki

akipn_lab11

Jan 11th, 2022 (edited)
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. program zmienna;
  2. #include("stdlib.hhf");
  3.  
  4. static
  5.  
  6. liczba: int32;
  7.  
  8. begin zmienna;
  9.  
  10. stdout.put(nl, "Wprowadz liczbe: ");
  11. stdin.get(liczba);
  12. mov(&liczba, ebx);
  13. mov(250, eax);
  14. mov(eax, [ebx]);
  15.  
  16. stdout.put(nl, liczba, nl);
  17. stdout.puti32(eax);
  18.  
  19. end zmienna;
  20.  
  21.  
  22. program zmienna;
  23. #include("stdlib.hhf");
  24.  
  25. static
  26.  
  27. indeks: int32;
  28. tab32: int32[10] := [2000, 4000, 6000, 8000, 10000, 12000, 14000, 16000, 18000, 20000];
  29.  
  30. begin zmienna;
  31.  
  32. stdout.put(nl, "Podaj indeks elementu: ");
  33. stdin.get(indeks);
  34.  
  35.  
  36. for (mov(0, ecx) ; ecx < 10 ; inc(ecx)) do
  37.  
  38. stdout.put(tab32[ecx * 4], nl);
  39.  
  40. endfor;
  41.  
  42. end zmienna;
  43.  
  44.  
  45. program zmienna;
  46. #include("stdlib.hhf");
  47.  
  48. static
  49.  
  50. indeks: int32;
  51. tab8: int8[10] := [2, 4, 6, 8, 10, 12, 14, 16, 18, 20];
  52. tab32: int32[10] := [2000, 4000, 6000, 8000, 10000, 12000, 14000, 16000, 18000, 20000];
  53.  
  54. begin zmienna;
  55.  
  56. stdout.put("Tablica elementow int8: ", nl);
  57.  
  58. for (mov(0, ecx) ; ecx < 10 ; inc(ecx)) do
  59.  
  60. stdout.put(tab8[ecx]:6);
  61.  
  62. endfor;
  63.  
  64. stdout.newln();
  65. stdout.put("Tablica elementow int32: ", nl);
  66.  
  67. for (mov(0, ecx) ; ecx < 10 ; inc(ecx)) do
  68.  
  69. stdout.put(tab32[ecx * 4]:6);
  70.  
  71. endfor;
  72.  
  73. stdout.newln();
  74. stdout.put("Ktory element skopiowac: ");
  75. stdin.get(indeks);
  76. mov(indeks, ecx);
  77. mov(tab8[ecx], al);
  78. movsx(al, eax);
  79. mov(eax, tab32[ecx * 4]);
  80.  
  81. stdout.newln();
  82. stdout.put("Tablica elementow int32 po kopiowaniu z tablicy int8: ", nl);
  83.  
  84. for (mov(0, ecx) ; ecx < 10 ; inc(ecx)) do
  85.  
  86. stdout.put(tab32[ecx * 4]:6);
  87.  
  88. endfor;
  89.  
  90. end zmienna;
Add Comment
Please, Sign In to add comment