BoxIdee

Program architecture

As with any good (!) Integrated Develepment Environment the user must be able to start a new project writing the source code, assemble it and finally execute it, possibly with some sort of visual aid of what is happening.
This is how my project was implemented. It is based on three major sections, which are the Editor/Assembler , the Simulator and the I/O Panel & Monitor.

The process starts writing a text source code with the Editor and then assembling it with the Assembler (in the same module) which generates some files, one of which is the executable. The executable, loaded in the Simlator window, runs and interfaces with the I/O panel

The graphic appearence is highly customizable using the Option Panel.
Preferencies (i.e. colors and tips) and IDE variables are stored in the 'ASMSIM.ini' file before quitting the program.



Directories

The program expects to find the necessary files in the following directories which must reside in the same folder of program (VBP or EXE) directory:

  • For the EXE program
  • Sources - stores the sources text files
  • Codes - stores the executable files generated by Assembler
  • Tables - stores the auxiliary files generated by Assembler
  • Includes - contains the tables and the common labels definitions
  • Additional folders for the Basic program
  • Resources - contains pictures used to build the program
  • Aux prog - some utility programs (mainly, a kernel label building tool)



Files

The IDE uses and produces a number of files types with these associations:

  • .TXT - source files inside Sources
  • .HEX - executables produced by Assembler and used by Simulator
  • .LST - listing of the assembled file; useful to print for documentation
  • .ASS - working files used by Assembler (quite a sort of metalanguage); not to care about
  • .TBL - list of defined labels; not to care about
  • .VAR - list of defined variables; not to care about
  • .TIP - list of defined tooltips; not to care about





Instructions and Directives

The program accepts all the 6502 mnemonic codes and translate all this instructions but the 'SED', 'CLD', 'SEI' and 'RTI'. These will not generate any code.
These are accepted directives:

  • ORG: mandatory; starting address (in both decimal or hexadecimal formats)
  • END: mandatory; must be present at the end of program
  • EQU: assigns a value to a label (in both decimal or hexadecimal formats)
  • ASC: accepts a literal quoted string and converts it into the corresponding ascii codes
  • DBW: convert and writes a word (16 bit value) in 2 byes, LSB byte first
  • DFB: writes a byte value in code


Operators

The program recognizes the following operators inside an addressing scheme or label definition (here blank separated for clarity): * $ , ' # < > + - ( X Y )
The '*' means 'current address'
The '#' means 'decimal value'
The '< >' mean 'lower byte' and 'higher byte'



Kernel

Inside the 'Includes' folder there is a file called 'Kernel.txt'; this is text file with some common labels and addresses.
The ones beginning with 'IO' refers to the IO Panel elements (i.e. leds and switches); your program can access these elements by mean of their defined names.
(see the example)

Other important definitions, beginning with 'k' are for routines executed by your host (not the emulator) to speed up the execution (i.e. 'kPrint' or 'kInput')



Alternative to the Editor

The source files are standard text documents which can be created with any text editor.
To respect the format expected by the Assembler, the user must only follow these guidelines:

  • LABELS: must start at the very first position (no blanks allowed before)
  • COMMENTS: are recognized by a trailing ';' (semicolon) - they can start anywhere
  • INSTRUCTIONS and OPERATOR: there must be 1 blank space (at least) separating the preceeding text
  • END: this keyword directive must be present at the end of source code



Performances

Despite of being written in VB, and possibly not very optimized, the execution speed is quite good.
On my Pentium IV 2.4GHz, the compiled version runs at about 500 I/Sec (Instructions per second) with I/O enabled (and used); disabling the main windows animation (program tracking), it reaches about 32K I/Sec; disabling even the I/O window (which disables the Memory Map and Variables refresh too), it arrives at about 150K I/sec.


Click any immagine to zoom in


Main window

Code example


CNT           EQU     $4F
TMP           EQU     $F
;start of program
              ORG     $1000
              LDX     #$1
              STX     TMP
              DEX
              STX     IODGR1
              STX     IODGR2
              STX     IODGR3

;external loop
EXTLP         LDX     #0
              STX     CNT
              LDA     IOSW
              STA     IODGR3
LOOPINT       CLC
              LDA     IOSW0,X
              BEQ     SKIP
              SEC
SKIP          ROR     CNT
              INC     IODGR1
              BNE     SKIP2
              INC     IODGR2
SKIP2         INX
              CPX     #8
              BNE     LOOPINT
              LDA     CNT
              STA     IOLEDA
              JMP     EXTLP
              RTS
              END
					

ì