Package asm

The Cebollita assembler implements a subset of standard MIPS assembly language.

See:
          Description

Class Summary
Asm Entry point to the assembler.
AsmData An abstract class representing literal data in an assembly file.
AsmDataSpace Assembly file space directive.
AsmDataString Assembly file string as data.
AsmDataWord Assembly file word as data.
AsmFile Represents a file of assembly code.
AsmIns Represents a single assembly instruction.
Linker The Linker takes multiple object files and produces a single executable.
Module Used to represent a single object file.
 

Package asm Description

The Cebollita assembler implements a subset of standard MIPS assembly language. The assembler is somewhat table driven, so the actual set of MIPS instructions that it handles can vary. However, here is the bare minimum set of instructions it can and does encode:

Arithmetic
ADD, ADDI, SUB, MULT*, DIV*, SLT, SLTI
Logic
OR, ORI, AND, ANDI, XOR, XORI, SLL, SRL, SRA, SLLV, SRAV, SRLV
Memory
LW, SW, LB, SB
Control
J, JAL, JR, BEQ, BNE, BLEZ, BGTZ
Random
SYSCALL, BREAK, NOP, RFE, MFC0, MTC0
(*) In the Cebollita world, MULT and DIV are implemented as regular R-type (three register) instructions. They do not make use of the HI and LO registers -- rather, they simply place the 32 interesting (low) bits of their result into the destination register. The high bits are discarded.

Running the assembler:

Please see the tools section for the definitive guide to using this tool.

This will create a file called file.o:

  java asm.parser file.s
Passing the --version flag will print out version info.

MIPS assembly subset

The Cebollita MIPS assembler implements a subset of real MIPS assembly. Instructions: It implements most of the standard R-type, I-type, and J-type instructions for arithmetic, control, and memory operations. It does not handle floating point instructions, or ANY pseudo-operations. Pseudo-ops are a lie that confuse the capabilities of the assembler, and have no real place in an introductory setting like this.

Data: The following data directives are the only ones recognized:

[label] .space [bytes]
[label] .word  [value]
[label] .asciiz [string]
Because of limitations of the linker, labels can ONLY be used in conjunction with BEQ, BNE, BGTZ, BLTZ, LW, SW, LB, SB, J, JAL, ADDI, ORI.

Running the linker:

Please see the tools section for the definitive guide to using this tool.

This will link the two provided files:

  java asm.Linker file1.o file2.o
The linker understand the following flag:
--bare
spit out a bare executable (just instructions).
--version
spit out version info and die
--at [address]
link the executable as if it living at [address] (default 0)
--start [label]
use [label] for the executable entry point (default __start)

Inspecting a module:

Please see the tools section for the definitive guide to using this tool.

This will spit out information about an object file:

  java asm.Module file1.o