Skip to content
Robert Kuhfß edited this page Oct 30, 2018 · 2 revisions

.addinstr


.block

The .block command is used to quickly insert any amount of data quickly and easily rather than having to use large numbers of the .dw or .db commands. This is very handy if you need to insert a buffer for something like a screen. Rather than having 384 .dw 0 commands you can simply do one command, .block 768.

This command is also useful if you need to actually move the program counter to a certain location, rather than just change SPASM's internal program counter with .org. For example if you were writing a multi page app and had a routine at $6030 on the first page and wanted the exact same routine at the same place on the second page you could use .block to ensure your routine was located there.

Usage:

.block size

Parameters

  • size The size of the data you wish to insert. The data is inserted is set to 0. If you want to fill a certain value of data, look at the directive .fill.

.byte


.db


.dw


.echo


.end


.error


.fill


.list


.nolist


.option


.org

The .org command is used to change the internal location of SPASM's program counter. This is mostly used when calculating addresses for absolute jumps or calls. Note: changing pc via .org does NOT change any actual data. If you are at location $8000 and you change to $C000 SPASM does not insert $4000 bytes of data. If you want to add these bytes of data, look at the .block or .fill commands.

Example

;pc = 0
Label0:    ;pc = 0
    jp Label3
Label3:    ;pc = 3
.org $2000
    jp Label6

When loaded on the device this will be at address $0006 You will need to copy any data between Label6 and Label6End to $2000

Label6:    ;pc = 2003
    ld a,Label3
    ret
Label6End:

This will set the internal pc back to where it normally is to do this dynamically look at the relocate include file:

.org 9

Usage

.org address

Parameters

  • address The location you want to change SPASM's pc to.

.seek

Warning: If you are thinking about using this command, do not. Using the command can cause serious errors in your program. There are very few, if any, cases in which this directive should be used.

The .seek command is used to change SPASM's internal program counter in the way .org cannot. .seek can be used to change SPASM's pc to any location already written and rewrite existing data.

Example

.db 0, 1, 2
.db 3, 4, 5
.db 6, 7, 8
.seek 3
.db "LOL"
.seek 9

is equivalent to

.db 0, 1, 2
.db "LOL"
.db 6, 7, 8

This example would create a data 0-8 as the first 9 bytes. The seek command goes the value 3 and replaces 3,4,5 with 'L', 'O', 'L'

Usage

.seek address

Parameters

  • address The address of the data you wish to seek to.

.show

The .show command is used to output the definition of a macro to the command line. This is often useful for debugging purposes.

Usage

.show define

Parameters

  • define The define to show the contents of.

.word