Nasm-X86

 view release on metacpan or  search on metacpan

lib/Nasm/X86.pm  view on Meta::CPAN

  Mov r10, $pa;                                                                 # Private and anonymous map
  Mov r8,  $fdes;                                                               # File descriptor for file backing memory
  Mov r9,  0;                                                                   # Offset into file
  Syscall;
  Mov rdi, $size;
  RestoreFirstSevenExceptRaxAndRdi;
 }

#D1 Strings                                                                     # Operations on Strings

sub CreateByteString()                                                          # Create an relocatable string of bytes in an arena and returns its address in rax
 {@_ == 0 or confess;
  Comment "Create byte string";
  my $N = 4096;                                                                 # Initial size of string

  my ($string, $size, $used, $data) = All8Structure rax, 3;                     # String base

  my $sub = S                                                                   # Create string
   {SaveFirstFour;
    Mov rax, $N;
    AllocateMemory;

lib/Nasm/X86.pm  view on Meta::CPAN

    my $r = Assemble;                                                             # Assemble and execute
    ok index($r =~ s([^0x0-0x7f]) ()gsr, readFile($0) =~ s([^0x0-0x7f]) ()gsr)>-1;# Output contains this file


=head1 Strings

Operations on Strings

=head2 CreateByteString()

Create an relocatable string of bytes in an arena and returns its address in rax


B<Example:>


    Start;                                                                        # Start the program
    my $q = Rs my $t = 'ab';

    my $s = CreateByteString;                                                     # Create a string  # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

lib/Nasm/X86.pm  view on Meta::CPAN

8 L<ClearMemory|/ClearMemory> - Clear memory - the address of the memory is in rax, the length in rdi

9 L<ClearRegisters|/ClearRegisters> - Clear registers by setting them to zero

10 L<Close|/Close> - Close a file descriptor

11 L<Comment|/Comment> - Insert a comment into the assembly code

12 L<CopyMemory|/CopyMemory> - Copy memory, the target is addressed by rax, the length is in rdi, the source is addressed by rsi

13 L<CreateByteString|/CreateByteString> - Create an relocatable string of bytes in an arena and returns its address in rax

14 L<Db|/Db> - Layout bytes in the data segment and return their label

15 L<Dbwdq|/Dbwdq> - Layout data

16 L<Dd|/Dd> - Layout double words in the data segment and return their label

17 L<Dq|/Dq> - Layout quad words in the data segment and return their label

18 L<Ds|/Ds> - Layout bytes in memory and return their label



( run in 1.700 second using v1.01-cache-2.11-cpan-71847e10f99 )