SPRDEF

From C64-Wiki
Jump to navigationJump to search
BASIC keyword
Keyword: SPRDEF
Abbreviation: s, p, r, SHIFT+D
Type: Command
Token code: (254 29) / $fe $1d
Handling routine
in BASIC ROM:
List of all BASIC keywords


Remark: This article describes the BASIC command SPRDEF in Commodore BASIC 7.0 or higher.

Type: Command
General Programming-Syntax: SPRDEF

The command SPRDEF activates the integrated sprite editor of the C128. The command may be called both in direct mode and within a program. Superfluous parameters lead to the error message after exiting the editor. ?SYNTAX ERROR. Besides editing sprites, the editor can also be used to edit characters or as a kind of zoom mode for a graphics program. However, it should be noted that any existing graphics will be destroyed by the editor.

Hint: Other sprite commands in BASIC 7.0 are MOVSPR, RSPCOLOR, RSPPOS, RSPRITE, SPRCOLOR, SPRITE and SPRSAV, also BUMP, COLLISION, GSHAPE and SSHAPE.

The Editor[edit | edit source]

The start of the editor.
A small sprite: Smiley.
An example of a multicolor sprite.
Another example of a multicolor sprite with x- and y-scale.

Below the workspace of 24×21 fields (corresponding to the 24×21 pixels of a sprite), the question is displayed for the user to select one of the eight possible sprites.

Sprite Selection[edit | edit source]

Key Info
1  to 8  Selects the corresponding sprite and starts the working mode.
RETURN  Ends the editor session and returns to the calling environment.

In the normal sprite mode, the cursor is +.
In the multicolor sprite mode, the cursor is ++.

Keys in Working Mode[edit | edit source]

Key Info
Shift +RETURN  Saves the designed sprite and returns to the sprite selection.
RUN/STOP  Discards changes and returns to sprite selection.
CRSR  keys (up, down, left, right) Moves the cursor in the workspace.
RETURN  Places cursor at the beginning of the next line (except for the last line, where it is positioned only at the 1st column).
CLR/HOME  Places the cursor in the upper left corner of the workspace.
Shift +CLR/HOME  Clears the sprite grid and positions the cursor in the upper left corner.
1  Deletes point.
2  Sets point in foreground color.
3  Sets point in additional color 1 (for multicolor sprite).
4  Sets point in additional color 2 (for multicolor sprite).
A  Enables/disables automatic cursor movement (to the right) for pixel change keys 1  to 4 .
C  Copies pattern from another sprite. 1  to 8  selects the sprite, RETURN  cancels the action.
CTRL +1  to CTRL +8  Selects one of the foreground colors from 1 to 8 (for color numbers see COLOR.
C= +1  to C= +8  Selects one of the foreground colors from 9 to 16.
X  Turns double width sprite on/off.
Y  Enables/disables double height of thesprite.
M  Turns multicolor mode on/off.
Important tips
  • The sprite multicolor colors cannot be changed in the editor, but must be set beforehand with the command SPRCOLOR.
  • The editor does not offer the possibility to save the designs to a diskette or to load them from there. This can be done with these commands:
    • BSAVE "FILENAME",B0,P3584 TO P4096 or
    • BLOAD "FILENAME",B0,P3584


Examples[edit | edit source]

10 SPRDEF
20 INPUT "SPRITES SAVE AS";N$
30 IF N$<>"" THEN BSAVE (N$),B0,P3584 TO P4096

First, this calls the internal sprite editor with SPRDEF and then saves the sprites under the name entered with INPUT.

BASIC V7.0 Commands

ABS | AND | APPEND | ASC | ATN | AUTO | BACKUP | BANK | BEGIN | BEND | BLOAD | BOOT | BOX | BSAVE | BUMP | CATALOG | CHAR | CHR$ | CIRCLE | CLOSE | CLR | CMD | COLLECT | COLLISION | COLOR | CONCAT | CONT | COPY | COS | DATA | DCLEAR | DCLOSE | DEC | DEF FN | DELETE | DIM | DIRECTORY | DLOAD | DO | DOPEN | DRAW | DS | DS$ | DSAVE | DVERIFY | EL | ELSE | END | ENVELOPE | ER | ERR$ | EXIT | EXP | FAST | FETCH | FILTER | FN | FOR | FRE | GET | GET# | GETKEY | GO64 | GOSUB | GOTO | GRAPHIC | GSHAPE | HEADER | HELP | HEX$ | IF | INPUT | INPUT# | INSTR | INT | JOY | KEY | LEFT$ | LEN | LET | LIST | LOAD | LOCATE | LOG | LOOP | MID$ | MONITOR | MOVSPR | NEW | NEXT | NOT | (OFF) | ON | OPEN | OR | PAINT | PEEK | PEN | (PI) | PLAY | POINTER | POKE | POS | POT | PRINT | PRINT USING | PRINT# | PUDEF | (QUIT) | RCLR | RDOT | READ | RECORD | REM | RENAME | RENUMBER | RESTORE | RESUME | RETURN | RGR | RIGHT$ | RND | RREG | RSPCOLOR | RSPPOS | RSPRITE | RUN | RWINDOW | SAVE | SCALE | SCNCLR | SCRATCH | SGN | SIN | SLEEP | SLOW | SOUND | SPC( | SPRCOLOR | SPRDEF | SPRITE | SPRSAV | SQR | SSHAPE | ST | STASH | STEP | STOP | STR$ | SWAP | SYS | TAB( | TAN | TEMPO | THEN | TI | TI$ | TO | TRAP | TROFF | TRON | USR | VAL | VERIFY | VOL | WAIT | WHILE | WINDOW | WIDTH | XOR