Assembler

From Spartan Blue CPU

Jump to: navigation, search

The assembler is written in Perl (converted from awk).

The asm script drives it all. It first runs the system's C preprocessor against the file. That output is fed through blue.pl which generates a .lst file. Finally the asm2bin.awk and asm2hex.awk scripts convert the list file to either binary (suitable for sending to the board over the serial port) or an Intel hex fil.

The assembler knows several psuedo ops:

  • org - Origin
  • equ - Equate
  • ds - Define string
  • end - End of program

The assembler can "fake" constants by storing them and generating an address for them. For example:

   lda #' '
   add #1

The built-in symbol _location_ returns the current location.

Personal tools