package mtmc.os.shell.builtins import mtmc.emulator.MonTanaMiniComputer import mtmc.os.shell.ShellCommand import mtmc.tokenizer.MTMCTokenizer class AssembleCommand : ShellCommand() { @Throws(Exception::class) public override fun exec(tokens: MTMCTokenizer, computer: MonTanaMiniComputer) { val fs = computer.fileSystem val src = tokens.collapseTokensAsString() require(!(src == null || src.isBlank())) { "missing or required argument 'src'" } /* val srcPath: Path = getDiskPath(src, fs) val dst = tokens.collapseTokensAsString() require(!(dst == null || dst.isBlank())) { "missing required argument 'dst'" } val dstPath: Path = getDiskPath(dst, fs) val contents = Files.readString(srcPath) val assembler = Assembler() val file_name = fs.resolve(src) // srcPath.toString().substring(DISK_PATH.toString().length()).replaceAll("\\\\", "/"); val executable = assembler.assembleExecutable(file_name, contents) executable.dump(dstPath) computer.notifyOfFileSystemUpdate() */ } override val help: String get() = """ asm - src : path to a .asm file - dst : path to a target output binary """.trimIndent() companion object { /* fun getDiskPath(pathString: String, fs: FileSystem): Path { val path = Path.of("disk" + fs.resolve(pathString)) return path.toAbsolutePath() } */ } }