POT (BASIC 7.0)

From C64-Wiki
(Redirected from POT)
Jump to: navigation, search
BASIC keyword
Keyword: POT
Abbreviation: P Shift+O
Type: Function
Token code:
Handling routine
in BASIC ROM:
List of all BASIC keywords


Remark: This article describes the BASIC function POT in Commodore BASIC V7.0 oder 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 paddless.

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

The POT command returns the input values of the potentiometer (paddle) inputs. The returned value is an unusual 9-bit number, where the eight least-significant bits show the potentiometer reading, and the ninth bit is active when a paddle fire button is pressed (the paddles used the joystick left and right buttons as fire buttons). The value returned is 0-255 without the fire button down, 255 if no paddle is connected, and 256 is added to the value when the corresponding fire button is down.

Examples[edit]

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


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


V = POT(1) AND 255


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


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 | COLINT | 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 | ON | OPEN | OR | PAINT | PEEK | PEN | (PI) | PLAY | POINTER | POKE | POS | POT | PRINT | PRINT USING | PRINT# | PUDEF | 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 | WIDTH | XOR