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 could 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: Another 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 for a multicolor sprite.
Another example for 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  Save the designed sprite and return to the sprite selection.
RUN/STOP  Discard changes and return to sprite selection.
CRSR  keys (up, down, left, right) Move the cursor in the workspace.
RETURN  Place cursor at the beginning of the next line (except for the last line, where it is positioned only at the 1st column).
CLR/HOME  Place the cursor in the upper left corner of the workspace.
Shift +CLR/HOME  Clear the sprite grid and position the cursor in the upper left corner.
1  Delete point.
2  Set point in foreground color.
3  Set point in additional color 1 (for multicolor sprite).
4  Set point in additional color 2 (for multicolor sprite).
A  Enable/disable automatic cursor movement (to the right) for pixel change keys 1  to 4 .
C  Copy pattern from other sprite. 1  to 8  select the sprite, RETURN  cancels the action.
CTRL +1  to CTRL +8  Select one of the foreground colors from 1 to 8 (for color numbers see COLOR.
C= +1  to C= +8  Select one of the foreground colors from 9 to 16.
X  Turn double width sprite on/off.
Y  Enable/disable double height of the sprite.
M  Turn multicolor mode on/off.
Important tips
  • The sprite multicolour colours 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 diskette or to load them from there. This can do with this 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 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