mirror of
https://github.com/engineer-man/piston.git
synced 2025-05-15 16:16:28 +02:00
add nasm and nasm64
This commit is contained in:
parent
bc80269ce2
commit
d258bed574
10 changed files with 108 additions and 99 deletions
52
runtimes/nasm.nix
Normal file
52
runtimes/nasm.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{pkgs, piston, ...}:
|
||||
let
|
||||
pkg = pkgs.nasm;
|
||||
binutils = pkgs.binutils;
|
||||
in piston.mkRuntime {
|
||||
language = "nasm";
|
||||
version = pkg.version;
|
||||
|
||||
aliases = [
|
||||
"nasm32"
|
||||
"asm"
|
||||
];
|
||||
|
||||
compile = ''
|
||||
${pkg}/bin/nasm -f elf32 -o binary.o "$@"
|
||||
${binutils}/bin/ld -m elf_i386 binary.o -o binary
|
||||
'';
|
||||
|
||||
run = ''
|
||||
shift
|
||||
./binary "$@"
|
||||
'';
|
||||
|
||||
tests = [
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.asm" = ''
|
||||
SECTION .DATA
|
||||
good: db 'OK',10
|
||||
txtlen: equ $-good
|
||||
|
||||
SECTION .TEXT
|
||||
GLOBAL _start
|
||||
|
||||
_start:
|
||||
mov eax,4
|
||||
mov ebx,1
|
||||
mov ecx,good
|
||||
mov edx,txtlen
|
||||
int 80h
|
||||
mov eax,1
|
||||
mov ebx,0
|
||||
int 80h
|
||||
'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.asm";
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue