This commit is contained in:
root
2026-09-19 20:21:47 +02:00
commit 0798933b05
62 changed files with 7658 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
// Command asm assembles ship-program source into the binary that the
// program endpoint accepts: asm prog.s > prog.bin
package main
import (
"fmt"
"os"
"wh/vm"
)
func main() {
if len(os.Args) != 2 {
fmt.Fprintln(os.Stderr, "usage: asm <source.s> > program.bin")
os.Exit(2)
}
src, err := os.ReadFile(os.Args[1])
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
prog, err := vm.Assemble(string(src))
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
os.Stdout.Write(prog)
}