Minidisc Control Program
Jump to navigation
Jump to search
Minidisc Control Lead - Program
DECLARE SUB sendremote (send%, lptdat%, delay!)
DECLARE SUB WriteTitle (delay!)
' TitleAid 70X
' Program for remote control and title input on a
' Sharp MD-Recorder. Originally for the MD-MS701
' Thomas H. Meier, Germany, Mannheim, 12.07.1999 / QuickBasic 4.5
' Modified for the MD-MT161 by T. Styles and R. Jarvis, 15.01.2001
'
' Hardware from www.mannheim-netz.de/user/meierth/MD70X.html
' For the MD-MS701
' Key: Resist. output value
' none pressed 212k &HF8
' Play Mode 72k &HF7
' Display 50k5 &HF6
' Bass 35k5 &HF5
' Minus-Key (-) 25k5 &HF4
' Plus-Key (+) 18k6 &HF3
' Rewind <-- 14k &HF2
' Forward --> 10k &HF1
' Stop 6k8 &HF0
'
' For the MD-MT161:
CONST none% = &HFF
CONST mode% = &HFB
CONST DISP% = &HFA
CONST bass% = &HDD
CONST minus% = &HDC
CONST plus% = &HD8
CONST rew% = &HD5
CONST forw% = &HE6
CONST stopp% = &H80
CLS
' Get PrinterPort Address
DEF SEG = 64 ' BIOS - DataSegment
lptdat% = PEEK(&H9) * 256 + PEEK(&H8) ' get address of LPT1:
DEF SEG = 0 ' Return to 0-Segment
maxloop = 10
PRINT "Please stand by !"
PRINT "Calibrating delay loop ";
calib:
PRINT ".";
'du$ = INKEY$
start = TIMER
FOR i = 1 TO maxloop: NEXT i
finish = TIMER
gone = finish - start ' choose a good period:
IF gone < 3! THEN maxloop = maxloop * 10: GOTO calib
cycles = maxloop / gone
delay = INT(cycles / 20) ' one keytouch takes 2*1/10sec
' Init hardware of MD-Remote ' none% = &HF8
send% = none% ' &HFx for voltage supply
sendremote send%, lptdat%, delay ' &Hx8 for "No key pressed"
char$ = "X"
WHILE char$ <> "E"
CLS
PRINT "Minimal Control (Delay="; delay; ")"
PRINT "==============="
PRINT "Stop s Playmode p"
PRINT "Forward -> v Bass b"
PRINT "Back <- z Display d"
PRINT "Plus + Minus -"
PRINT "End E Write Title w";
DO ' wait for key
char$ = INKEY$
LOOP UNTIL char$ <> ""
SELECT CASE char$
CASE "s"
send% = stopp%
CASE "v"
send% = forw%
CASE "z"
send% = rew%
CASE "+"
send% = plus%
CASE "-"
send% = minus%
CASE "b"
send% = bass%
CASE "d"
send% = DISP%
CASE "p"
send% = mode%
CASE "w"
WriteTitle delay
CASE "E"
send% = none%
CLS
CASE ELSE
send% = none%
END
END SELECT
sendremote send%, lptdat%, delay
WEND ' end of main loop
SUB sendremote (send%, lptdat%, delay)
OUT (lptdat%), send% ' press key ...
FOR i = 1 TO delay: NEXT i
OUT (lptdat%), none% ' ... and release it !
FOR i = 1 TO delay: NEXT i
END SUB
SUB WriteTitle (delay)
CONST DISP% = &HFA
CONST rew% = &HD5
CONST forw% = &HE6
CONST plus% = &HD8
' Get PrinterPort Address
DEF SEG = 64 ' BIOS - DataSegment
lptdat% = PEEK(&H9) * 256 + PEEK(&H8) ' get address of LPT1:
DEF SEG = 0 ' Return to 0-Segment
REDIM strin$(3)
strin$(0) = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/ "
strin$(1) = "abcdefghijklmnopqrstuvwxyz.,/ "
strin$(2) = "1234567890!" + CHR$(34) + "#$%&'()*+,-./:;<=>?@_` "
CLS
PRINT "Edit. Enter. Ensure cursor is selecting small 'a'"
INPUT "Enter title >", title$
curdisplay = 1
curposalpha = 1
curposnum = 1
LOCATE 3, 14: PRINT
FOR i = 1 TO LEN(title$)
cur$ = MID$(title$, i, 1) 'current char
PRINT cur$;
WHILE cur$ = " "
sendremote plus%, lptdat%, delay 'send a space
i = i + 1
cur$ = MID$(title$, i, 1) 'current char
PRINT cur$;
WEND
FOR t = 0 TO 2 ' find appropiate string containing char
curstrin$ = strin$(t)
IF INSTR(curstrin$, cur$) <> 0 THEN
nextdisplay = t
END IF
NEXT t
curstrin$ = strin$(nextdisplay)
skipdisplay = (nextdisplay - curdisplay + 3) MOD 3 'calc number of times to press disp
FOR e = 1 TO skipdisplay 'press disp and record where you are
sendremote DISP%, lptdat%, delay
curdisplay = (curdisplay + 1) MOD 3
NEXT e
't = TIMER
'DO: LOOP UNTIL TIMER - t > 1
nextpos = INSTR(curstrin$, cur$)
IF curdisplay = 2 THEN
'deal in numbers
skippos = (nextpos - curposnum)
curposnum = nextpos
ELSE
'deal in chars
skippos = (nextpos - curposalpha)
curposalpha = nextpos
END IF
IF skippos > LEN(curstrin$) / 2 THEN
skippos = skippos - LEN(curstrin$)
ELSEIF skippos < -LEN(curstrin$) / 2 THEN
skippos = skippos + LEN(curstrin$)
END IF
IF skippos > 0 THEN
send% = forw%
ELSE
send% = rew%
END IF
FOR w = 1 TO ABS(skippos)
sendremote send%, lptdat%, delay
NEXT w
SOUND 255, 5
t = TIMER
DO: LOOP UNTIL TIMER - t > .8 '0.8 sec pause to press 'Enter'
NEXT i
END SUB