POT (BASIC 7.0)

From C64-Wiki
(Redirected from POT)
Jump to navigationJump to search
BASIC keyword
Keyword: POT
Abbreviation: P Shift+O
Type: Function
Token code: 206/$CE 2/$02
Handling routine
in BASIC ROM:
List of all BASIC keywords


Remark: This article describes the BASIC function POT in Commodore BASIC V7.0 or higher.

Type: Numeric Function 
General Programming-Syntax: POT(<numeric-expression>)

The POT command is a BASIC v7 function, used for reading the status of the paddles.

The numeric expression must be in range from 1 to 4, referring to the two potentiometer inputs on the two joystick ports. Using any other number generates an error with message ?ILLEGAL QUANTITY ERROR.

The POT command returns the corresponding value of the potentiometer (paddle) position. The returned value is a 9-bit integer number consisting of the eight least-significant bits according to the potentiometer position and the ninth bit which is active if a paddle fire button is pressed (the paddles uses the joystick left and right buttons as fire buttons). The value returned is in range from 0 to 255 without the fire button down, 255 if no paddle is connected, and 256 is added to the value in case the corresponding fire button is pressed.

Examples[edit | edit source]

DO: PRINT POT(3),POT(4),JOY(2): LOOP

Display the values of x and y directions on port 2. If the paddle's first fire button is pressed the value will be displayed as joystick direction left (with value 7). The second fire button as right direction with value 3. If both fire buttons are pressed the resulting value is 40.

IF POT(1) AND 256 THEN PRINT "PUSHED FIRE BUTTON FROM PADDLE 1"

Checks the condition of the fire button of paddle port 1.

V = POT(1) AND 255

Only the paddle value from port 1 is taken (fire button action is ignored) into variable V.

SOUND 1,2000,32767: DO :VOL POT(3)/16 AND 15: LOOP

Gives a permanent tone which is controlled by the position of the first paddle on port 2. The AND function filters the value range in that way that any influence from a pressed fire button is suppressed.


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