esolang/x86asm-nasm

Sponsored OSS

By esolang

Updated 11 months ago

Easily execute x86 Assembly (nasm) programming language

Image
Languages & Frameworks
Operating Systems
Security

276

x86 Assembly (nasm) programming language

This image is a part of esolang-box 2.4.0.

About

esolang-box project aims to provide easy and normalized interface for many (currently 227 (!)) programming languages by Docker, especially to uncommon esoteric programming languages.

The implementation and interpreter of language x86 Assembly (nasm) is included in this image and can be invoked by the simple one command x86asm-nasm. (it's also an alias of script command, so you can use either.)

This script accepts standard input as the input of program and the first argument as program code file. The output of the script will be printed into standard output. This convension is shared between all esolang-box images, so you can use another language easily.

Usage example

Run a single x86 Assembly (nasm) script

Supposing you have hello world script hello.x86.asm in the current directory like this:

$ cat hello.x86.asm
SECTION .data
	hello: db 'Hello, World!'

SECTION .text
	global main

main:
	mov edx, 13
	mov ecx, hello
	mov ebx, 1
	mov eax, 4
	int 0x80

	mov ebx, 0
	mov eax, 1
	int 0x80

You can execute it with the following command:

$ docker run --rm -v "$PWD":/code:ro esolang/x86asm-nasm x86asm-nasm /code/hello.x86.asm
Hello, World!
Processing input
$ docker run -i --rm -v "$PWD":/code:ro esolang/x86asm-nasm x86asm-nasm /code/hello.x86.asm < input.txt
Debug code with shell
$ docker run -it --rm -v "$PWD":/code:ro esolang/x86asm-nasm sh
# x86asm-nasm /code/hello.x86.asm
Hello, World!
Observing usage of exec syscalls

esolang-box 2.4.0 supports tracing of execve and execveat syscalls by strace command. Setting STRACE_OUTPUT_PATH environment variables and enabling ptrace will produce strace log to the specified path.

$ docker run --cap-add=SYS_PTRACE --rm -v "$PWD":/code --env STRACE_OUTPUT_PATH=/code/strace.txt esolang/x86asm-nasm x86asm-nasm /code/hello.x86.asm
Hello, World!

Some considerations:

Docker Pull Command

docker pull esolang/x86asm-nasm