kiama.example.oberon0.assembler

object Assembler

[source: kiama/example/oberon0/assembler/Assembler.scala]

object Assembler
extends AnyRef
Simple assembler for RISC machine programs. Basically adds code emission and symbolic label support to the underlying RISC ISA.
Type Summary
type Label
Symbolic labels.
Value Summary
var i : Int
val numreg : Int
Register data
val regs : scala.Array[Boolean]
Method Summary
def emit (instr : Instr) : Unit
Emit a RISC instruction.
def freeReg (i : Byte) : Unit
Free a register
def getFreeReg : Byte
Get free reg (between 1 and 28) Reserve R0 (=zero), R28 (PC), R29 (FP), R30 (SP), R31 (LNK)
def getcode : scala.Seq
Return the code sequence that has been emitted. Symbolic labels are resolved into numeric displacements before the sequence is returned.
def mark (label : Int) : Unit
Mark the current code emission position with the given label.
def newlabel : Int
Return a label that hasn't been used before.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Type Details
type Label
Symbolic labels.

Value Details
val numreg : Int
Register data

val regs : scala.Array[Boolean]

var i : Int

Method Details
def emit(instr : Instr) : Unit
Emit a RISC instruction.

def newlabel : Int
Return a label that hasn't been used before.

def mark(label : Int) : Unit
Mark the current code emission position with the given label.

def getcode : scala.Seq
Return the code sequence that has been emitted. Symbolic labels are resolved into numeric displacements before the sequence is returned.

def getFreeReg : Byte
Get free reg (between 1 and 28) Reserve R0 (=zero), R28 (PC), R29 (FP), R30 (SP), R31 (LNK)

def freeReg(i : Byte) : Unit
Free a register