Skip to content

Extended Commands

cursorkeys edited this page Mar 25, 2022 · 28 revisions

Since Commodore Basic V2 is limited compared to other languages, when it comes to graphics, music, etc, some extended commands have been added to help for those that want to code in Commodore 64 basic and environment, but still want have a few "modern comforts" available.

The Extended commands can be seen, as commands that would normally come in a cartridge, and expand the Commodore 64. Some of these are Final Cartridge, Power Card ridge and Simon's Basic.

The extended commands are not copied from any other cartridge, but new re imagined commands instead.

General Extended

XON

Turn on Extended commands.


XOFF

Turn off Extended commands.

HELP

List Extended commands.

Disk

DIR

Read the directory, but do not destroy the basic listing.

DELETE

Delete a file.

DISKLABEL

Set the label of the disk to the desired name.

Programming

SEEK SearchString

LIST all lines which contains the specified search-string.

PANIC

Return the screen mode to readable text. In case you got stuck with unreadable text, or in hires mode.

DEBUG

Same as the print command, but the output goes into the debugging console.

UNNEW

When you did a new command, and just realized you should not have.

RENUMBER _StartLine,_Step

Change line-numbers in your program PLANNED: Renumber also takes in consideration which method to use. There are these methods. 1. plain. It just renumbers using startline and step 2. data. It renumbers like in plain. But all data statements line numbers start with 1000, 2000, etc. 3. rem. Each line starting with "REM -", starts on the next 1000. (REM - indicates a code section)

REFORMAT

Normalize spaces inside your program

RESET

Reset the basic emulator

General

TURBO

Put the emulator in turbo mode. Your program should be approx. 50x faster. Tip: The cursor will flicker quicker when in Turbo mode, so you will be able to tell quickly when in editing mode.

SYNCTIME

Synchronizing the time of the emulator with your host computer. By default, 00:00:00 is set to the time the emulator was started.

WJIFFY

Slow down turbo mode, and wait for the next loop-jiffy to expire. Only use for "Lazy Timing", since a loop-jiffy is approx 1/50th of a second, but this may not be accurate.

SLOW

Put the emulator in normal mode. (ie. exit Turbo mode).

PATH _X1, _Y1, _X2, _Y1, _Progress, _XOut, _YOut

Returns a point on a hypothetical line, between beginning (_Progress=0) and end (_Progress=1). _XOut and _YOut are output parameters, and must be variables.

Text & Bitmap commands

MODE _Mode

Select between the different text and graphics modes.

  • 0 - Text mode, mono color
  • 1 - Text mode, multi color
  • 2 - Hires, mono color
  • 3 - Hires, multi color

COLOR _RegisterIndex, _ColorIndex

Set the color registers to a specified color index.

Examples:

  • COLOR 0,1 : REM SET BORDER TO WHITE
  • COLOR 1,0 : REM BACKGROUND COLOR TO BLACK

The colors that can be set this way are.

  • 00 - Border color
  • 01 - Background Color
  • 02 - Background/Multi Color #1
  • 03 - Background/Multi Color #2
  • 04 - Sprite/Multi Color #1
  • 05 - Sprite/Multi Color #2
  • 06 - Sprite color 1
  • 07 - Sprite color 2
  • 08 - Sprite color 3
  • 09 - Sprite color 4
  • 10 - Sprite color 5
  • 11 - Sprite color 6
  • 12 - Sprite color 7
  • 13 - Sprite color 8

BORDER _ColorIndex

Set the border color. This is equivalent to COLOR 0,_ColorIndex.

Text screen commands

CLS

Clear the screen

PEN _ColorIndex

Setting pen color to the specified color index, between (0-15).

PENPOS _PenX, _PenY

Setting pen position to the specified x,y position.

CHAR _X, _Y, _CharCode

Change a character on the screen to character with _CharCode

CHAR( _X, _Y )

Retrieve a character code from the screen on position _X, _Y

CHARCOL _X, _Y, _Color

Change a character color on the screen to color _Color

CHARCOL( _X, _Y )

Retrieve a character color from the screen on position _X, _Y

Bitmap screen commands (Hires)

GCLS

Clear the screen for Graphics or bitmap mode.

GPEN _ColorShortIndex

Set the color-short-index for the graphics pen. This short index is either; 0,1,2 or 3 Each color cell on the screen, can have a maximum of 4 colors. Depending on the graphics mode, these 4 colors can be set per cell, or are global.

GCOLDEF _ColorShortIndex, _ColorIndex

This is related to the GPEN command. The _ColorShortIndex will be used to draw pixels to the screen. But the color cell decides the actual color that will be displayed for each short-index (between 0 and 2). With this command you can tell the graphics pen, to not only draw the pixels with the _ColorShortIndex, but also set the color cell so that these short indexes will match the desired display color. If this is confusing, you should read more about color cells on the Commodore 64. On the C64, and other 8-bit computers it is not that simple to just plot a blue pixel on the screen. First you need to plot the pixel, and then you need to tell the color cell in which it lays, what color the pixel is supposed to be displayed at.

GCOLORS _Col0, _Col1, _Col2

This command is equal to running in sequence GCOLDEF 0,_firstcolor: GCOLDEF 1,_secondcolor: GCOLDEF 2,_thirdcolor

LINE _X1,_Y1,_X2,_Y2

Draws a line with the current pen and color definitions.

BOX _X1,_Y1,_X2,_Y2

Draws a box with the current pen and color definitions.

HLINE _X1,_Y1,_X2

Draws a horizontal line with the current pen and color definitions.

HLINE _X1,_Y1,_X2

Draws a horizontal line with the current pen and color definitions.

PLOT _X1,_Y1

Draws a single pixel with the current pen and color definitions.

PIXEL(_X1,_Y1 )

Retrieves a single pixel. The returned value will be the _ShortColorIndex of the pixel.

PIXCOL(_X1,_Y1 )

Retrieves the color of single pixel. The returned value will be the _ColorIndex of the pixel.

Sprite Commands

SPRITE _SPNO, _ONOFFFLAG

Enables or disables sprite _SPNO (0-7). _ONOFFFLAG is 1 for enable, 0 for disable

SPOS _SPNO, _X, _Y

Positions the sprite _SPNO on position _X, _Y

SCOL _SPNO, _COL

Sets the sprite _SPNO to color _COL

SCOLMOD _SPNO, _COLORMODE

Sets the sprite _SPNO to color mode _COLORMODE

  • ColorMode: 0 -> Single color hires spite
  • ColorMode: 1 -> Multi color lores sprite

SDOUBLE _SPNO, _XDOUBLE, _YDOUBLE

Expand the sprite _SPNO in 2x size. _DOUBLE and _YDOUBLE, can be 0 for false, 1 for true

SFRAME _SPNO, _FRNO

Sets the sprite _SPNO to the frame _FRNO

SFPOKE _FRNO, _OFF, _VAL

Sets a byte sprite memory inside frame _FRNO, on offset _OFF (0-62)

SFCOPY _SRC_FRNO, _DEST_FRNO

Copies/Clones the sprite frame data from source frame to destination frame

SFXFLIP _FRNO

Flips a sprite frame on the x axis

SFYFLIP _FRNO

Flips a sprite frame on the y axis

SFX _FRNO, _EFFECTNO

Apply an effect to the sprite frame buffer

  • 0: mirror the sprite horizontally (see SFXFLIP)
  • 1: mirror the sprite vertically (see SFYFLIP)
  • 10: Make the sprite semi transparent, by dithering, first pixel is off
  • 11: Make the sprite semi transparent, by dithering, first pixel is on

See example1: Sprite Example

See example2: Sprite Example