Source Files

This preprocessor option adds another file at this line in your program. It is exactly the same as taking all the code in the file, removing the #include line and pasting the code in its place. A simple example is show below.


#include “”
.org $9d95
.db 06Dh, 0BBh
 ld hl,Source
 ld de,Destination
 ld bc,Size

Source = $9872
Destination = $86EC
Size = 768

As you can see Source, Destination, and Size are all defined in the header file, allowing the main.asm code to be streamlined. A common file to include is A SPASM compatible version can be found on the include files page.


SPASM can also include bitmaps into your source code, converting from 255 level grayscale to whatever options you specify. The options are specified using the .option directive. Once you have specified your options they remain constant for the rest of the source file. You can however redefine them by simply using .option again. Including bitmaps is exactly like including source files.

.option bm_pad = 1                 ;bmp has 1 pixel padding around it
.option bm_min_w = 16                   ;width of the actual data is 16 pixels
.option BM_HDR_FMT="WW,HH,SS"           ;the header will store a word for the width,
                                        ;a word for the height, and a word for the size
.option BM_SHD = 4                      ;4 level grayscale
#include “Sprites\MainChar.bmp”         ;import the bitmap

Last edited Sep 28, 2011 at 6:08 PM by BuckeyeDude, version 14


No comments yet.