Added assembler merging

This commit is contained in:
Eduard Urbach 2023-10-31 14:50:53 +01:00
parent 92b7c22c61
commit 8549aedc60
Signed by: eduard
GPG key ID: 49226B848C78F6C8
6 changed files with 122 additions and 63 deletions

View file

@ -62,6 +62,11 @@ func (a *Assembler) Finalize(verbose bool) ([]byte, []byte) {
return code, data
}
// Merge combines the contents of this assembler with another one.
func (a *Assembler) Merge(b *Assembler) {
a.Instructions = append(a.Instructions, b.Instructions...)
}
// MoveRegisterData moves a data section address into the given register.
func (a *Assembler) MoveRegisterData(reg register.ID, data []byte) {
a.Instructions = append(a.Instructions, Instruction{