{"id":21515485,"url":"https://github.com/meharehsaan/intelx86_64","last_synced_at":"2026-05-19T15:43:17.467Z","repository":{"id":160385128,"uuid":"626479470","full_name":"meharehsaan/intelx86_64","owner":"meharehsaan","description":"This is repo contans all assembly language codes written and analyzed while learning  assembly language","archived":false,"fork":false,"pushed_at":"2023-11-09T06:50:57.000Z","size":1047,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T02:35:28.075Z","etag":null,"topics":["assembly","basics","c","concepts","nasm","x86-64"],"latest_commit_sha":null,"homepage":"","language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meharehsaan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-04-11T14:49:36.000Z","updated_at":"2024-03-21T16:16:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d7d4413-227d-4351-80f5-30e3ef50e178","html_url":"https://github.com/meharehsaan/intelx86_64","commit_stats":null,"previous_names":["meharehsaan/intelx86_64"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meharehsaan%2Fintelx86_64","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meharehsaan%2Fintelx86_64/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meharehsaan%2Fintelx86_64/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meharehsaan%2Fintelx86_64/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meharehsaan","download_url":"https://codeload.github.com/meharehsaan/intelx86_64/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244066190,"owners_count":20392407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assembly","basics","c","concepts","nasm","x86-64"],"created_at":"2024-11-23T23:55:29.848Z","updated_at":"2026-05-19T15:43:17.430Z","avatar_url":"https://github.com/meharehsaan.png","language":"Assembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"# intel x86_64 assembly\n\nis an unstructured programming language meaning it provides only extreme `basic programming` control structures.\n\n- Basic Expression.\n- R/W over memory.\n- Jump Operators.\n\n#### Tells us\n\n- How hardware works\n- Optimize program speed and size.\n  - For example, use **mov al, 5** instead of **mov eax, 5** if only the lower 8 bits of eax are needed.\n- Writing device drivers, `OS kernals`, Compilers and embedded systems.\n- Reverse Engineering.\n\n#### In assembly\n\n- No procedure calls **-\u003e** argument processing is done manually.\n- No loops **-\u003e** need to jump instead.\n- No variable/functions scope **-\u003e** everything is global.\n\n\u003cbr\u003e\n\n### Resources\n\n---\n\n- **Playlist ::** [Arif Butt](https://www.youtube.com/watch?v=fYHAnSoCgbk\u0026list=PL7B2bn3G_wfCC2HDSXtMFsskasZ5fdLXz\u0026pp=iAQB)\n- **Github ::** [Arif Butt](https://github.com/arifpucit/COAL_VLecs)\n\n\u003cbr\u003e\n\n## Contents\n\nIn this Repository [intelx86-64-asm](https://github.com/meharehsaan/intelx86-64)\n\n1. `first.nasm` template\n2. `Datatypes` in assembly\n3. GDB `debugger`\n4. `Moving` data instructions\n5. `Arithemtic` instruction\n6. Bitshifting `rotation` instructions\n7. `Logical` instructions\n8. Control `jumps`\n9. `Functions` in assembly\n10. Function calling `conventions`\n11. Mixing `C` with `assembly`\n12. Getting `input` in assembly\n13. Some `practice`\n\n### Compiler\n\n---\n\nI am using `NASM` compiler while others like `GASM` can also be used for assembly compilations and `ld` is the linker in assembly.\n\n```bash\n# NASM\nnasm -fefl64 filename.nasm     # Compiling file\nld filename.o -o filename      # Linking\n./filename                     # Executing binary\n```\n\n\u003cbr\u003e\n\n## Registers\n\n---\n\n#### General-Purpose Registers (x86)\n\n- EAX (`Accumulator`): Used for arithmetic and logic operations. It is also the primary register for function return values.\n- EBX (`Base`): Used as a base pointer for memory access and can be used for other general purposes.\n- ECX (`Counter`): Often used as a loop counter or for other specialized counting tasks.\n- EDX (`Data`): Used for arithmetic and logic operations. It is also used to hold the high 32-bits of 64-bit results.\n- ESI (`Source Index`): Used for source data in string and memory operations.\n- EDI (Destination Index): Used for destination data in string and memory operations.\n- ESP (`Stack Pointer`): Points to the top of the stack, used for managing the call stack.\n- EBP (`Base Pointer`): Points to the base of the current stack frame, used for accessing function parameters and local variables.\n\n#### 64-bit Extension of General-Purpose Registers (x86_64)\n\n- RAX, RBX, RCX, RDX, RSI, RDI: The 64-bit counterparts of their 32-bit equivalents.\n- R8 - R15: Additional general-purpose registers available in x86_64 mode, providing more options for data manipulation.\n\n#### Segment Registers (x86)\n\n- CS (Code Segment): Holds the code segment address.\n- DS (Data Segment): Holds the data segment address.\n- SS (Stack Segment): Holds the stack segment address.\n- ES (Extra Segment): Holds an extra data segment address.\n- FS, GS: Additional segment registers available for specific purposes in some CPU architectures.\n\n#### Flags Register (EFLAGS/RFLAGS)\n\n- Register used for status \u0026 CPU control information out of 64 bits mostly unsed and reserved for future use.\n- `Status Flags`\n  - MSB\n  - Overflow\n  - Logic\n- `Control Flags`\n  - String Operations\n  - Direction\n- `System Flags`\n  - Interrupts\n  - Debugging\n- Contains various status and control flags, such as carry(CF), zero(ZF), sign(SF), overflow(OF), etc. The flags register is updated automatically by certain instructions.\n\n#### Instruction Pointer (EIP/RIP):\n\n- Points to the next instruction to be executed in the program.\n\n#### SSE Media Regisers\n\n- (XMM0 to XMM7) These are `128-bit registers`, each capable of holding 16 bytes or 4 single-precision floating-point numbers or 2 double-precision floating-point numbers or 16 packed 8-bit integers or 8 packed 16-bit integers.\n- XMM8 to XMM15 (Available in x86_64 mode)Additional 128-bit registers that are available only in x86_64 mode, providing more media registers for SIMD operations.\n\n![Registers](/img/registerSet.png)\n\n\u003cbr\u003e\n\n## Mnemonics\n\n---\n\n#### x86_64 Assembly Instructions\n\n- mov, add, sub, syscall etc.\n\n#### Pseudo Instructions\n\n- DB, DW, RESB, RESW, EQU\n\n#### Assembler Directives\n\n- SECTION, EXTERN, GLOBAL, BITS\n\n\u003cbr\u003e\n\n### SECTION .data\n\n---\n\nThe data section is used to define `static` data variables that the program uses during its execution. It includes constants, initialized variables, and arrays.\n\n```\nSECTION .data\n    myvar db 42   ; Define a byte (8-bit) variable with value 42.\n    myarr dw 10, 20, 30, 40  ; Define a word (16-bit) array with values.\n```\n\n\u003cbr\u003e\n\n### SECTION .bss\n\n---\n\nThe BSS (Block Started by Symbol) section is used to define `uninitialized data` variables. These variables are allocated memory, but their initial values are not specified. The BSS section is typically used for variables that will be initialized at `runtime or dynamically` during program execution.\n\n```\nSECTION .bss\n    buffer resb 100   ; Reserve 100 bytes of memory for the buffer variable.\n```\n\n\u003cbr\u003e\n\n### SECTION .text\n\n---\n\nThe code section is where the `actual` executable instructions of the program are placed. It contains the assembly code that performs various operations and calculations. This section typically starts with a label, followed by the code instructions.\n\n```\nSECTION .text\n    global _start   ; Entry point of the program\n\n_start:\n\n    mov eax, 1      ; System call number for exit\n    mov rdi, 0      ; Exit code 0\n    syscall         ; Invoke the system call\n```\n\n## Additional Links\n\n- [Learning C](https://github.com/meharehsaan/learning-c)\n- [Operating System](https://github.com/meharehsaan/operating-system)\n- [System Programming](https://github.com/meharehsaan/system-programming)\n- [Socket Programming](https://github.com/meharehsaan/socketprogramming)\n- [Buffer Overflow](https://github.com/meharehsaan/bufferoverflow)\n- [Linux Utilities](https://github.com/meharehsaan/linux-utilities)\n- [Programming Concepts](https://github.com/meharehsaan/progconcepts)\n- [Resources](https://github.com/meharehsaan/resources)\n\n---\n\nBest Regards - [Mehar Ehsaan](https://github.com/meharehsaan)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeharehsaan%2Fintelx86_64","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeharehsaan%2Fintelx86_64","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeharehsaan%2Fintelx86_64/lists"}