{"id":19851891,"url":"https://github.com/stackoverflowexcept1on/hello-world-64","last_synced_at":"2025-02-28T21:16:16.627Z","repository":{"id":138029461,"uuid":"537583108","full_name":"StackOverflowExcept1on/hello-world-64","owner":"StackOverflowExcept1on","description":"The real programmers can write hello world in 64 bytes of machine code!","archived":false,"fork":false,"pushed_at":"2023-02-27T23:22:53.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T13:23:59.124Z","etag":null,"topics":["assembly","hello-world","low-level","syscalls","windows","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/StackOverflowExcept1on.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-16T18:51:23.000Z","updated_at":"2024-12-07T12:09:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"28fe6eb4-c200-4b6a-bf05-fa9d463f5fb4","html_url":"https://github.com/StackOverflowExcept1on/hello-world-64","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackOverflowExcept1on%2Fhello-world-64","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackOverflowExcept1on%2Fhello-world-64/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackOverflowExcept1on%2Fhello-world-64/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackOverflowExcept1on%2Fhello-world-64/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StackOverflowExcept1on","download_url":"https://codeload.github.com/StackOverflowExcept1on/hello-world-64/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241240734,"owners_count":19932609,"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","hello-world","low-level","syscalls","windows","x86-64"],"created_at":"2024-11-12T13:33:07.234Z","updated_at":"2025-02-28T21:16:16.593Z","avatar_url":"https://github.com/StackOverflowExcept1on.png","language":"Assembly","readme":"# hello-world-64\n\n[![Build Status](https://github.com/StackOverflowExcept1on/hello-world-64/actions/workflows/build.yml/badge.svg)](https://github.com/StackOverflowExcept1on/hello-world-64/actions/workflows/build.yml)\n\nThe real programmers can write hello world in 64 bytes of machine code!\n\n![image](https://i.imgur.com/DqUNBSV.png)\n\nThis repository contains code in assembly language targeting Windows x86_64.\n\nHere is a list of things that are used to achieve this size:\n\n- undocumented `PEB` structure - https://en.wikipedia.org/wiki/Process_Environment_Block\n- syscall ABI on Windows\n- shadow space in stacks\n- a lot of hacks to reduce code size\n    - push \u0026 pop compiles to 3 bytes of machine code (val \u003c 128)\n      ```asm\n      ; reg = val\n      push val ; 2 bytes\n      pop reg ; 1 byte\n      ```\n    - hack that allows to push string address to the stack and pop it back\n      ```asm\n      ; reg = address of data, i.e. reg points to \"my data goes here\"\n      call data_label\n      data: db 'my data goes here'\n      data_label: pop reg\n      ```\n    - xor of 32-bit registers allows us to zero out a 64-bit register in 2 bytes of code\n      ```asm\n      xor edx, edx ; 31 d2\n      xor rdx, rdx ; 48 31 d2\n      ; but it's same\n      ```\n    - if you want to set `rdx` to `0` you can use `cdq` to do it in 1 byte (bit 63 of rax should be 0)\n      ```asm\n      push 0x60 ; 6a 60\n      pop rax ; 58 (rax = 0x60, bit 63 of rax = 0)\n      cdq ; rdx = 0\n      ```\n- see [main.asm](main.asm) for better explanation\n\n### Building\n\nYou need to install [NASM](https://nasm.us) and unpack it into this directory or add to env variable PATH\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackoverflowexcept1on%2Fhello-world-64","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackoverflowexcept1on%2Fhello-world-64","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackoverflowexcept1on%2Fhello-world-64/lists"}