Assembler - Pseudo Operations PDS

C64Studio currently only implements a subset of pseudo operations of PDS. These pseudo ops are supported in PDS mode:




DC.B, DC.V, DB, DEFM, DM, DFM, CBM

This pseudo op allows to insert text, characters, or one ore more bytes at the current location.

Allowed are text literals, character literals, constant values, expressions and labels as content.
text literals are surrounded by ", character literals by '
Constant values can be set as decimal, hexadecimal (with prefixed $), chars (surrounded by ' or ").
Labels are treated as 16-bit values. To get the high or low byte prefix the label with < (low byte) or > (high byte)
Expressions are evaluated during the final pass. They must evaluate to a valid byte value.
CBM works like !TEXT, but reverses character casing.



DC.B "HELLO WORLD" DC.V " SCORE",60," 00000000 ",224,224," LEVEL",60," 00 ",225,225," LIVES",60," 03 *" DB 206,184,191,182,198,196,184,0,203,198,0,202,198,204,191,191,184,202,202,0,0 DEMOMESS CBM "WELCOME TO THE FIRST MAYHEM MEGA MUSIC MIX "


DW

This pseudo op allows to insert words (2 bytes) at the current location.

Allowed are constant values, expressions and labels as content.
Constant values can be set as decimal, hexadecimal (with prefixed $).
Labels are treated as 16-bit values.
Expressions are evaluated during the final pass. They must evaluate to a valid word value.



;inserts $80, $77 DW &7780


DH

This pseudo op allows to insert text, characters, or one ore more bytes at the current location. The pseudo op inserts the high bytes of the evaluated data.

Allowed are text literals, character literals, constant values, expressions and labels as content.
text literals are surrounded by ", character literals by '
Constant values can be set as decimal, hexadecimal (with prefixed $), chars (surrounded by ' or ").
Labels are treated as 16-bit values.
Expressions are evaluated during the final pass. They must evaluate to a valid byte value.



;inserts $20 DC.H $2000


DL

This pseudo op allows to insert text, characters, or one ore more bytes at the current location. The pseudo op inserts the low bytes of the evaluated data.

Allowed are text literals, character literals, constant values, expressions and labels as content.
text literals are surrounded by ", character literals by '
Constant values can be set as decimal, hexadecimal (with prefixed $), chars (surrounded by ' or ").
Labels are treated as 16-bit values.
Expressions are evaluated during the final pass. They must evaluate to a valid byte value.



;inserts $00 DC.L $2000


HEX <hex data>

This pseudo op interprets the rest of the line as hex data, no commas or prefixes like $ or 0x. Data may be separated by spaces, but pairs need to be intact.



PANELCOL HEX 0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0000 HEX 0F0F0F0F0F050505050F0F090909090909090909090909090909090F0909000F0505050F0F0F0000


INCBIN <file name>[,<size>,[<skip>]]

This pseudo op inserts a file as binary data. The file name is required without apostrophes!

<size> sets the number of bytes that are read from the file. If it is not set the whole file is included.

<skip> sets the number of bytes that are skipped from the start of the file. If it is not set no bytes are skipped.



INCBIN ..\CHARS\LEVEL1.CHR


INCLUDE <file name>

This pseudo op includes another source file at the current location. File names are used relative to the file containing the directive.



INCLUDE PLOTDOWN.PDS ; data down sides


ERROR <message>

This pseudo op adds an error message to the compile result, essentially breaking the build. The message can be any combination of strings and expressions. Expressions are evaluated where possible.

This pseudo op can be useful inside conditional pseudo op statements to do safety checking.



ERROR You PRAT!.........Only one loader at a time.


IF <expression>
ELSE
ENDIF

This pseudo op starts an conditional block. The conditional block is only evaluated if the expression yields a result not equal to zero. The opening curly brace must be on the same line.

IF checks if the expression is not equal zero, and if it is, all code until the next matching ENDIF are added.

A conditional block has to end with an ENDIF statement. An optional else statement may open an opposite conditional block.


IF DISK_LOAD ! TAPE_LOAD JMP $7780 ELSE JMP START_CODE ; start game ENDIF


DS <count>[,<value>]

This pseudo op fills the given value count times at the current location.
For the expression form the expression is evaluated for every byte. The expression inside the brackets uses the label "i" as index, ranging from 0 to count - 1. Any global "i" label is suspended inside the brackets and restored afterwards.



DS 64*4,0 ; clear out


DO
UNTIL <expression>

DO <expression>
LOOP

This pseudo op marks the beginning of either a DO-UNTIL loop or a DO-LOOP loop. The difference is determined by the argument of DO.



;DO-UNTIL loop DO DL ((value*@4)+@5) ; Low Byte value = value + 1 UNTIL value > @3 ;DO-LOOP loop (loop 8 times) DO 8 ADD 20 JR NC,$1 INC H $1 INC DE LOOP


<Function Name> MACRO

This pseudo op defines a macro function. To end the body of a function specify ENDM
The number of parameters is variable.

To call a macro use <Function Name> [<Parameter 1>[,<Parameter 2>],..]

Parameters inside the macro are assigned to labels @1 up to @9.



ZP MACRO @1 EQU VARS VARS = VARS+@2 ENDM ;call macro ZP R6510,1 ; I/O PORT ZP NMISAVEA,1 ; Irq & Nmi reg saves ZP IRQSAVEA,1


PROCESSOR, FREE, SEND, SKIP, INFO, RUN, EXEC, START, DSECT, DEND, MSW

These pseudo op are merely included to safely allow assembling, but do not do anything.



PROCESSOR 6502 FREE 8000h-$ SEND Serial1 SKIP 13 INFO RUN EXEC $0801 START $0801 DSECT DEND MSW


END

This pseudo op ends the parsing of the file at the current line.


rts END This file is a carefully handcrafted demo


REPEAT <expression>

This pseudo op repeats the following line [expression] times.



REPEAT 4 inx