Skip to content

juan-db/libft-asm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libft-asm

Part 1

  • bzero
  • strcat
  • isalpha
  • isdigit
  • isalnum
  • isascii
  • isprint
  • toupper
  • tolower
  • puts (obviously, you can use the write syscall)

Part 2

  • strlen
  • memset
  • memcpy
  • strdup (obviously you are allowed to call malloc)

Part 3

To conclude, you must code a ft_cat function which will take a file descriptor (for example 0...) as argument and that will have the same behavior as the cat command it’ll return void.

Nasm on macOS

  • Stack must be 16-bit aligned.
  • Symbols must be prefixed with an underscore (e.g. _printf).
  • Syscalls on x86_64 uses the same opcodes as x86.
  • Syscall opcodes must be offset by x200000, i.e. a syscall to write (usually 0x4) would be 0x2000004 (2, five 0's, 4).

Useful articles

Tutorial on nasm assembly, covers plenty of topics:

Stack?

Sample code:

Complete tutorial (lots of useful information but overall not extremely reliable information):

strlen (a little extra info on rep and scasb):

Syscalls/interfacing with Linux:

Architecture (describes register purposes):

x86 opcode and instruction set reference:

Not exactly sure what this is but I used the x86-64 psABI version 1.0 document for register reference on p. 23 (version 1, Jan 28, 2018). The document contains a lot of information on the x86-64 architecture:

Debugging:

Some answers that cleared up confusion for me:

And, of course, there is always the official documentation:

About

WeThinkCode libft project implemented in x86_64

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published