| Home CBM ASCII-X BASIC Disk Commands Enter RUN mode Program Format Secret Variables Variable Format Expressions Keywords (divide) (equal) (less) (minus) (more) (multiply) (plus) (power) 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 Delete Dim Directory Dispose Dload Do Dopen Draw Ds Ds string Dsave Dverify El Else End Envelope Er Err Exit Exp Fast Fetch Filter Fn For Fre Get Get num Getkey Go Gosub Goto Graphic Gshape Header Help Hex If Input Input num 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 num Pudef Quit Rclr Rdot Read Record Rem Rename Renumber Restore Resume Return Rgr Right Rlum 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 string To Trap Troff Tron Until Using Usr Val Verify Vol Wait While Width Window Xor Syntax Tokens C128 D64plus Disk Escape Codes Hardware PCxface PETSCII Pet2asc Futurama IBM PC-AT Contact Games Glossary Hall of fame Hall of shame Miscellaneous Privacy policy Programming Twisty puzzles |
SPRDEF
Machine statement management. Suspend BASIC and enter the sprite editor.
SPRDEF invokes an interactive editor for defining sprite images. Like CBM's screen editor, it is quite easy to use. The basic operation is you select a sprite to edit, use the cursor keys to select a pixel and press a number key to write/erase the pixel. Full details follow. Note that SPRDEF may be used as a statement in a program but is rare; it is normally used as command in direct mode when developing softare. Although SPRDEF allows you to set most parameters of any sprite you edit (see SPRITE), it provides no way to set either of the two colors which are shared by all multi-color sprites (see SPRCOLOR). When SPRDEF first begins, it will (try to) allocate a VIC-II bitmap if not already allocated. This may generate OUT OF MEMORY ERROR. Otherwise the high-resolution bitmap will be cleared and displayed with a large edit window on the left.
The outer loop of SPRDEF begins. It asks "SPRITE NUMBER?" and waits for you to type a number between 1 and 8 to select a sprite to edit. If you press Return (or Enter) at this point, the display is switched back to text mode, SPRDEF ends, and BASIC resumes. Upon resumption, BASIC will check if any parameters were given to SPRDEF; if so, SYNTAX ERROR occurs. The following assumes you pressed a valid number key. The image of the selected sprite is saved in a temporary buffer. This allows recovery/undo described later. Next the selected sprite's motion is halted and it is positioned at sprite coordinate (264, 74) [see MOVSPR] which is on the right half of the screen near the top. The choosen sprite is enabled and can be seen with its last-set parameters (see SPRITE). All other sprites are disabled. The pixels of the sprite's image are drawn at 8x magnifaction in the edit window on the left half of the screen. The sprite-cursor is set to (0,0). The auto-advance feature is activated; this will automatically advance the sprite-cursor one pixel to the right (with wrap to next line) when a pixel-plotting key (a number) is pressed. Now SPRDEF enters its main / inner loop.
SPRDEF renders the sprite-cursor as + or ++ in the large edit window (if the sprite is in high-resolution or multi-color mode, respectively). Now it waits for you to press a key. When you press a key, the sprite-cursor is erased. The following keys are recognized and perform the indicated action:
When you press C (for Copy), SPRDEF will prompt "COPY FROM?" and waits for a number 1 ~ 8 or Return/Enter. When one of those keys are pressed, the prompt is erased. If you pressed a number, the selected sprite's image is copied to the sprite currently being edited. Otherwise nothing is copied. Nothing effectively happens if you copy from the same sprite being edited. In any case, the main/inner loop continues. The eight sprite images are stored sequentialy in Bank 0 RAM between 3584 and 4095 inclusive, 64 bytes each (although only the first 63 bytes of each sprite image is used by the VIC-II(e) chip). The data may be saved with BSAVE or loaded with BLOAD. You may also use SPRSAV to save a sprite's image to/from a string. Because SPRDEF is an interactive editor, there are no examples of it; however below are examples to save your creation, and load it back later.
© H2Obsession, 2014 |