Skip to content

Debian container for writing Assembly & C programs

License

Notifications You must be signed in to change notification settings

timohuovinen/nasm-gcc-container

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Docker container configured for writing NASM x86 Assembly & C.

The container has NASM, GCC, GDB, Make, Vim, et cetera installed.

Requirements

  • macOS, Linux, or Windows 10
  • Docker

Setup

Make sure you've got Docker running, then run

docker compose build

Development

To load the Debian container's Bash shell run

docker compose run nasm-gcc

...and you'll see a command prompt like this

llp@fa82417446cc:/usr/src#

Compilation & Linking

The nasm-gcc/src dir is mounted from your host as a volume in the Docker container, so file changes made on the host or in the container will show up in both places. This makes it possible to edit files in your host's editor, then compile, link, and run them in the Docker container.

To compile and create an executable program from nasm-gcc/src/helloworld.asm, for example, run docker-compose run nasm-gcc to enter the container shell, then run

nasm -felf64 helloworld.asm -o helloworld.o 
ld -o helloworld.out helloworld.o           # link helloworld.out with helloworld.o
chmod u+x helloworld.out                    # give helloworld.out execute permission
./helloworld.out                            # run helloworld.out

or just make run

...and you'll see "hello world!" printed to stdout.

Disassembly

To disassemble an executable, run

ndisasm -b 64 helloworld.out > _helloworld.asm

About

Debian container for writing Assembly & C programs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Makefile 47.2%
  • Assembly 26.9%
  • Dockerfile 25.9%