assembler

package
v0.0.0-...-d53882e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package assembler implements the assembler functionality for retrocomputers.

The assembler converts assembly language source code into machine code for retro computer systems. It supports multiple assembly formats (asm6, ca65, nesasm) and follows a multi-stage pipeline architecture:

1. Parse AST nodes (text → AST or direct AST input) 2. Process macros and expand definitions 3. Evaluate expressions and resolve symbols 4. Update data sizes based on expressions 5. Assign memory addresses to instructions and data 6. Generate opcodes for target architecture 7. Write final output to memory segments

The assembler is designed for both library integration (AST-first) and CLI usage (text-based), providing flexible APIs for different use cases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assembler

type Assembler[T any] struct {
	// contains filtered or unexported fields
}

Assembler is the assembler implementation for retro computer systems. It processes assembly language and converts it into machine code through a multi-stage pipeline. The generic type T represents the target architecture.

func New

func New[T any](cfg *config.Config[T], writer io.Writer) *Assembler[T]

New returns a new assembler.

func (*Assembler[T]) Process

func (asm *Assembler[T]) Process(ctx context.Context, inputReader io.Reader) error

Process processes assembly source code from a reader and assembles it into the output writer. This is the primary text-based API for CLI usage. For library integration with pre-parsed AST nodes, use ProcessAST instead.

func (*Assembler[T]) ProcessAST

func (asm *Assembler[T]) ProcessAST(ctx context.Context, nodes []ast.Node) error

ProcessAST processes pre-parsed AST nodes and assembles them into the output writer. This is the primary AST-based API for library integration where AST nodes are already available. For text-based assembly from readers, use Process instead.

func (*Assembler[T]) Steps

func (asm *Assembler[T]) Steps() []step[T]

Steps of the assembler to execute, in order.

Directories

Path Synopsis
Package config provides the assembler configuration.
Package config provides the assembler configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL