{"id":28168500,"url":"https://github.com/stanistan/exercises.assembly-book","last_synced_at":"2025-05-15T15:13:42.510Z","repository":{"id":25357863,"uuid":"28785635","full_name":"stanistan/exercises.assembly-book","owner":"stanistan","description":"Working through Programming From The Ground Up","archived":false,"fork":false,"pushed_at":"2017-04-09T17:19:21.000Z","size":21,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-20T03:34:14.416Z","etag":null,"topics":["assembly"],"latest_commit_sha":null,"homepage":null,"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/stanistan.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}},"created_at":"2015-01-04T20:49:49.000Z","updated_at":"2018-06-30T17:28:49.000Z","dependencies_parsed_at":"2022-08-06T04:01:26.078Z","dependency_job_id":null,"html_url":"https://github.com/stanistan/exercises.assembly-book","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/stanistan%2Fexercises.assembly-book","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanistan%2Fexercises.assembly-book/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanistan%2Fexercises.assembly-book/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanistan%2Fexercises.assembly-book/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stanistan","download_url":"https://codeload.github.com/stanistan/exercises.assembly-book/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254364267,"owners_count":22058880,"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"],"created_at":"2025-05-15T15:13:41.869Z","updated_at":"2025-05-15T15:13:42.505Z","avatar_url":"https://github.com/stanistan.png","language":"Assembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning Assembly\n\nGoing through _[Programming From The Ground Up](http://mirrors.fe.up.pt/pub/nongnu//pgubook/ProgrammingGroundUp-1-0-booksize.pdf)_.\n\n---\n\n#### Initial Setup\n\nI am running all of the exercises in a Ubuntu VM via Vagrant (``precise32``).\n\n1. Get Vagrant [here](https://www.vagrantup.com/downloads) or, if using [Homebrew](https://brew.sh):\n\n    ```\n    brew cask install virtualbox\n    brew cask install vagrant\n    ```\n\n2. Get the box\n\n    ```\n    vagrant box add precise32 http://files.vagrantup.com/precise32.box\n    ```\n\n3. Pick a place to have the vm.\n\n    ```\n    cd path/to/proj\n    vagran init precise32\n    vagrant up\n\n    # I have the project running as shared on the vm.\n    git clone git@github.com:stanistan/exercises.assembly-book.git book\n    ```\n\n4. Dependencies on the VM (TODO: move to Vagrantfile and actually manage the dependencies)\n\n    ```\n    vagrant ssh\n    # once on the VM\n    sudo apt-get install make\n    sudo apt-get install libc6-dev-i386\n    ```\n\n#### `./run`\n\nI'm using this to assemble and my program.\n\nIt operates on source files in `src` and sends `.o` and binaries to `build`, which itself\nis ignored by git.\n\n```\n# on the vm\n$\u003e vagrant ssh\n$\u003e cd /vagrant/book # or whatever the path is\n\n# assemble:\n# will build the object files for all of the inputs\n$\u003e ./run assemble read-records read-record count-chars write-newline alloc\n  [/vagrant/book/src]: as --32 ./read-records.s -o ../build/read-records.o\n  [/vagrant/book/src]: as --32 ./read-record.s -o ../build/read-record.o\n  [/vagrant/book/src]: as --32 ./count-chars.s -o ../build/count-chars.o\n  [/vagrant/book/src]: as --32 ./write-newline.s -o ../build/write-newline.o\n  [/vagrant/book/src]: as --32 ./alloc.s -o ../build/alloc.o\n\n# link:\n# will run the linker outputing the binary\n# of the first argument\n$\u003e ./run link read-records read-record count-chars write-newline alloc\n  [/vagrant/book/build]: ld -m elf_i386 read-records.o read-record.o count-chars.o write-newline.o alloc.o -o read-records\n\n\n# build:\n# runs assemble then link on the same args.\n$\u003e ./run build read-records read-record count-chars write-newline alloc\n  ...\n\n# simple:\n# run it, also echoing the exit status.\n# the equivalent of ./run build factorial \u0026\u0026 ./run exec factorial\n$\u003e ./run simple factorial\n  [/vagrant/book/src]: as --32 ./factorial.s -o ../build/factorial.o\n  [/vagrant/book/build]: ld -m elf_i386 factorial.o  -o factorial\n  EXIT STATUS: 24\n```\n\n### Dependencies and weirdness\n\nThe book itself \u0026 all of its examples are on a 32bit runtime, so given my own\nignorance and wanting to continue moving through it on a 64bit vm (maybe this was a\nproblem overall), requires some patching.\n\n__Assembling__\n\n```\nas --32 foo.s -o foo.o\n```\n\n__Linking__\n\n```\nld -m elf_i386 foo.o -o foo\n```\n\n### Noticed errata\n\n... Need to add things here from earlier portions of the book.\n\n###### Chapter 10\n\n- `Page 204` - [DAV's Endian FAQ](http://david.carybros.com/html/endian_faq.html) - the URL in the book is no longer active.\n\n### Quotes\n\n###### Chapter 12\n\n\u003e For example, pregnancy is not very parallelizable because no matter\n\u003e how many women you have, it still takes nine months.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstanistan%2Fexercises.assembly-book","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstanistan%2Fexercises.assembly-book","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstanistan%2Fexercises.assembly-book/lists"}