Implemented bitwise operations
This commit is contained in:
@ -26,6 +26,14 @@ func (a Assembler) Finalize() ([]byte, []byte) {
|
||||
code = x64.AddRegisterRegister(code, operands.Destination, operands.Source)
|
||||
}
|
||||
|
||||
case AND:
|
||||
switch operands := x.Data.(type) {
|
||||
case *RegisterNumber:
|
||||
code = x64.AndRegisterNumber(code, operands.Register, operands.Number)
|
||||
case *RegisterRegister:
|
||||
code = x64.AndRegisterRegister(code, operands.Destination, operands.Source)
|
||||
}
|
||||
|
||||
case SUB:
|
||||
switch operands := x.Data.(type) {
|
||||
case *RegisterNumber:
|
||||
@ -153,6 +161,14 @@ func (a Assembler) Finalize() ([]byte, []byte) {
|
||||
})
|
||||
}
|
||||
|
||||
case OR:
|
||||
switch operands := x.Data.(type) {
|
||||
case *RegisterNumber:
|
||||
code = x64.OrRegisterNumber(code, operands.Register, operands.Number)
|
||||
case *RegisterRegister:
|
||||
code = x64.OrRegisterRegister(code, operands.Destination, operands.Source)
|
||||
}
|
||||
|
||||
case POP:
|
||||
switch operands := x.Data.(type) {
|
||||
case *Register:
|
||||
@ -177,6 +193,14 @@ func (a Assembler) Finalize() ([]byte, []byte) {
|
||||
case SYSCALL:
|
||||
code = x64.Syscall(code)
|
||||
|
||||
case XOR:
|
||||
switch operands := x.Data.(type) {
|
||||
case *RegisterNumber:
|
||||
code = x64.XorRegisterNumber(code, operands.Register, operands.Number)
|
||||
case *RegisterRegister:
|
||||
code = x64.XorRegisterRegister(code, operands.Destination, operands.Source)
|
||||
}
|
||||
|
||||
default:
|
||||
panic("unknown mnemonic: " + x.Mnemonic.String())
|
||||
}
|
||||
|
Reference in New Issue
Block a user