SOUND Utility
Posted: Thu Nov 30, 2023 9:48 pm
I'm thinking about enhancing a few of the utilities in the UTILS menu. My bugbear with the native SOUND utility is that it doesn't tell you the existing setting; also I'm not keen on menu items with the same starting letter (On and Off in the native utility) - as I like to press the associated key.
Please, comments and criticisms on my coding style:
Please, comments and criticisms on my coding style:
Code: Select all
SOUND:
LOCAL k% :REM Key Click flag
LOCAL s% :REM Sound flag
LOCAL m% :REM Menu Result
LOCAL kf$(2),sf$(2) :REM Strings for 'On or Off'
UDG 0,9,10,12,10,9,0,0,21 :REM K
UDG 1,14,8,12,8,14,0,0,21 :REM E
UDG 2,10,10,4,4,4,0,0,21 :REM Y
UDG 3,14,8,14,2,14,0,0,21 :REM S
UDG 4,14,10,10,10,14,0,0,21 :REM O
UDG 5,0,0,0,0,0,0,0,21 :REM <Space>
UDG 6,0,0,31,0,0,0,0,21 :REM -
REM 7,0,0,14,10,10,0,0,21 :REM n
REM 7,6,8,12,8,8,0,0,21 :REM f
k%=PEEKB($20C0) :REM 0-Off 1-On
s%=PEEKB($00A4) :REM 1-Off 0-On
IF k%
UDG 7,0,0,14,10,10,0,0,21
kf$=CHR$(7)+CHR$(5)
ELSE
UDG 7,6,8,12,8,8,0,0,21
kf$=CHR$(7)+CHR$(7)
ENDIF
IF s%
sf$="ff"
ELSE
sf$="n "
ENDIF
CLS
AT 4,1 :PRINT "SET THE SOUND"
AT 5,2 :PRINT "Sound - O"+sf$
AT 1,3 :PRINT REPT$(CHR$(5),5)+CHR$(0)+CHR$(1)+CHR$(2)+CHR$(3)+CHR$(5)+CHR$(6)+CHR$(5)+CHR$(4)+kf$+REPT$(CHR$(5),5)
AT 1,4 :m%=MENUN(1,"SOUND,KEYS,EXIT")
IF m%=1
IF s% :REM Sound currently off
POKEB $00A4,0
PRINT CHR$(12)+CHR$(16)
ELSE
POKEB $00A4,1
ENDIF
ELSEIF m%=2
IF k% :REM Keys currently on
POKEB $20C0,0
ELSE
POKEB $20C0,1
ENDIF
ENDIF
REM **********************
REM * SET THE SOUND *
REM * Sound - Off *
REM * Keys - Off *
REM *Sound Keys Exit *
REM **********************