Improved assembler
This commit is contained in:
@ -33,25 +33,25 @@ func New(directory string) *Build {
|
||||
|
||||
// Run parses the input files and generates an executable file.
|
||||
func (build *Build) Run() error {
|
||||
err := build.Compile()
|
||||
// err := build.Compile()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
|
||||
list := asm.InstructionList{}
|
||||
a := asm.New()
|
||||
|
||||
list.MoveRegisterNumber(register.Syscall0, syscall.Write)
|
||||
list.MoveRegisterNumber(register.Syscall1, 1)
|
||||
list.MoveRegisterNumber(register.Syscall2, 0x4000a2)
|
||||
list.MoveRegisterNumber(register.Syscall3, 6)
|
||||
list.Syscall()
|
||||
a.MoveRegisterNumber(register.Syscall0, syscall.Write)
|
||||
a.MoveRegisterNumber(register.Syscall1, 1)
|
||||
a.MoveRegisterNumber(register.Syscall2, 0x4000a2)
|
||||
a.MoveRegisterNumber(register.Syscall3, 6)
|
||||
a.Syscall()
|
||||
|
||||
list.MoveRegisterNumber(register.Syscall0, syscall.Exit)
|
||||
list.MoveRegisterNumber(register.Syscall1, 0)
|
||||
list.Syscall()
|
||||
a.MoveRegisterNumber(register.Syscall0, syscall.Exit)
|
||||
a.MoveRegisterNumber(register.Syscall1, 0)
|
||||
a.Syscall()
|
||||
|
||||
result := list.Finalize()
|
||||
result := a.Finalize()
|
||||
result.Data.WriteString("Hello\n")
|
||||
|
||||
if !build.WriteExecutable {
|
||||
|
Reference in New Issue
Block a user