HLA - High Level Assembler
Przekazywanie parametrów przez wartość

program PassByValueDemo;
#include( "stdlib.hhf" );
var 
 i: int32;
 j: int32;
 
 procedure pbv( a:int32;  b:int32 );
 var 
    suma : int32;
 begin pbv;
 
   push( eax );
 
   // a = -1;
   mov( -1, a ); // Store -1 into the “a” parameter.
 
   // b = -2;
   mov( -2, b ); // Store -2 into the “b” parameter.
 
   // Print the sum of a+b.
   mov( b, eax );
   add( a, eax );
   mov( eax, suma);
   stdout.put( "a+b=", suma, nl );
 
 end pbv;
 
begin PassByValueDemo;
 
 mov( 50, i );
 mov( 25, j );
 
 // Call pbv passing i and j by value
 pbv( i, j );
 
 stdout.put
 ( 
  "i= ", i, nl, 
  "j= ", j, nl 
 );
end PassByValueDemo;
 


Tomasz Kapela, Kraków 2011-2020