Implemented indirect calls
This commit is contained in:
@ -111,6 +111,25 @@ func (a Assembler) Finalize() ([]byte, []byte) {
|
||||
|
||||
codePointers = append(codePointers, pointer)
|
||||
|
||||
case CALL_AT:
|
||||
code = x64.CallAtAddress(code, 0x00_00_00_00)
|
||||
size := 4
|
||||
// label := x.Data.(*Label)
|
||||
|
||||
pointer := &Pointer{
|
||||
Position: Address(len(code) - size),
|
||||
OpSize: 2,
|
||||
Size: uint8(size),
|
||||
}
|
||||
|
||||
pointer.Resolve = func() Address {
|
||||
destination := Address(0x1038)
|
||||
distance := destination - (pointer.Position + Address(pointer.Size))
|
||||
return Address(distance)
|
||||
}
|
||||
|
||||
codePointers = append(codePointers, pointer)
|
||||
|
||||
case COMMENT:
|
||||
continue
|
||||
|
||||
|
@ -29,6 +29,7 @@ const (
|
||||
|
||||
// Control flow
|
||||
CALL
|
||||
CALL_AT
|
||||
JE
|
||||
JNE
|
||||
JG
|
||||
@ -54,6 +55,8 @@ func (m Mnemonic) String() string {
|
||||
return "and"
|
||||
case CALL:
|
||||
return "call"
|
||||
case CALL_AT:
|
||||
return "call at"
|
||||
case COMMENT:
|
||||
return "comment"
|
||||
case COMPARE:
|
||||
|
Reference in New Issue
Block a user