diff --git a/etc/config/assembly.amazon.properties b/etc/config/assembly.amazon.properties index fe060514e..3e9ee3fad 100644 --- a/etc/config/assembly.amazon.properties +++ b/etc/config/assembly.amazon.properties @@ -1,4 +1,4 @@ -compilers=&nasm:&gnuas:&llvmas:&ptxas:&gnuasarm:&gnuasarm64 +compilers=&nasm:&gnuas:&llvmas:&ptxas:&gnuasarm:&gnuasarm64:&beebasm compilerType=assembly objdumper=/opt/compiler-explorer/gcc-11.2.0/bin/objdump supportsBinary=true @@ -302,6 +302,15 @@ compiler.ptxasnvcc115.objdumper=/opt/compiler-explorer/cuda/11.5.0/bin/nvdisasm compiler.ptxasnvcc115.semver=11.5.0 compiler.ptxasnvcc115.exe=/opt/compiler-explorer/cuda/11.5.0/bin/ptxas +group.beebasm.compilers=beebasm109 +group.beebasm.versionFlag=--help +group.beebasm.options= +group.beebasm.isSemVer=true +group.beebasm.baseName=BeebAsm +group.beebasm.compilerType=beebasm +compiler.beebasm109.semver=1.09 +compiler.beebasm109.exe=/opt/compiler-explorer/beebasm-1.09/beebasm + ################################# ################################# # Installed tools diff --git a/lib/compilers/_all.js b/lib/compilers/_all.js index bc99138c8..a95234484 100644 --- a/lib/compilers/_all.js +++ b/lib/compilers/_all.js @@ -26,6 +26,7 @@ export { AdaCompiler } from './ada'; export { AnalysisTool } from './analysis-tool'; export { AssemblyCompiler } from './assembly'; export { NasmCompiler } from './nasm'; +export { BeebAsmCompiler } from './beebasm'; export { Cc65Compiler } from './cc65'; export { CircleCompiler } from './circle'; export { ClangCompiler } from './clang'; diff --git a/lib/compilers/beebasm.js b/lib/compilers/beebasm.js new file mode 100644 index 000000000..90be55174 --- /dev/null +++ b/lib/compilers/beebasm.js @@ -0,0 +1,67 @@ +// Copyright (c) 2021, Compiler Explorer Authors +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import path from 'path'; + +import fs from 'fs-extra'; + +import { BaseCompiler } from '../base-compiler'; + +export class BeebAsmCompiler extends BaseCompiler { + static get key() { return 'beebasm'; } + + optionsForFilter() { + return ['-v', '-do', 'disk.ssd']; + } + + getSharedLibraryPathsAsArguments() { + return []; + } + + async runCompiler(compiler, options, inputFilename, execOptions) { + if (!execOptions) { + execOptions = this.getDefaultExecOptions(); + } + + const dirPath = path.dirname(inputFilename); + if (!execOptions.customCwd) { + execOptions.customCwd = dirPath; + } + + options.splice(- 1, 0, '-i'); + + const result = await this.exec(compiler, options, execOptions); + result.inputFilename = inputFilename; + const transformedInput = result.filenameTransform(inputFilename); + + if ((result.code === 0) && options.includes('-v')) { + const outputFilename = this.getOutputFilename(dirPath, this.outputFilebase); + fs.writeFileSync(outputFilename, result.stdout); + } + + this.parseCompilationOutput(result, transformedInput); + + return result; + } +}