Added assembler merging

This commit is contained in:
Eduard Urbach 2023-10-31 14:50:53 +01:00
parent b6be9357bf
commit 5c12992fca
No known key found for this signature in database
GPG key ID: C874F672B1AF20C0
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{