Use for incremental/decremental counting using arrow up/down keys, can start from a specified number and has reset to zero by pressing "Z", useful for music beat counting or keeping track of people entering/leaving etc.
Code: Select all
TALY:
LOCAL A%,KEY%
KSTAT 3
PRINT "Start From?"
INPUT A%
CLS
DO::
PRINT
PRINT " [";CHR$(169);"]";"[";CHR$(170);"]",A%
PRINT
PRINT" [Z]ero [Q]uit"
KEY%=GET
CLS
IF KEY%=3
A%=A%+1
GOTO DO::
ELSEIF KEY%=4
A%=A%-1
GOTO DO::
ELSEIF KEY%=%.
A%=0
GOTO DO::
ELSEIF KEY%=%6
ELSE GOTO DO::
ENDIF
Code: Select all
KCLK:
LOCAL S%
PRINT
PRINT " Current Setting",PEEKB(8384)
GET
CLS
PRINT
PRINT " New Setting"
AT 17,2: INPUT S%
POKEB 8384,S%
Beeps the piezo for the specified duration and frequency.
Code: Select all
BEEP:
LOCAL D%,F%,KEY%
START::
KSTAT 3
CLS
POKEB 8384,2
PRINT "Enter Duration"
INPUT D%
FREQ::
PRINT "Enter Frequency"
INPUT F%
POKEB 8384,0
REPLAY::
CLS
BEEP D%,F%
PRINT "Duration",D%
PRINT "Frequency",F%
PRINT "[P]lay [Q]uit"
PRINT "[A]new [F]req"
ASK::
KSTAT 1
KEY%=GET
IF KEY%=%A
GOTO START::
ELSEIF KEY%=%P
GOTO REPLAY::
ELSEIF KEY%=%F
CLS
GOTO FREQ::
ELSEIF KEY%=%Q
POKEB 8384,2
ELSE GOTO ASK::
RETURN
ENDIF