Added assembler merging

This commit is contained in:
2023-10-31 14:50:53 +01:00
parent b6be9357bf
commit 5c12992fca
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{