' TitleAid 70X ' Program for remote control and title input on the ' Sharp MD-Recorder MD-MS701 ' Thomas H. Meier, Germany, Mannheim, 12.07.1999 / QuickBasic 4.5 ' ' Hardware from www.mannheim-netz.de/user/meierth/MD70X.html ' 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 CONST none% = &HF8 CONST mode% = &HF7 CONST disp% = &HF6 CONST bass% = &HF5 CONST minus% = &HF4 CONST plus% = &HF3 CONST rew% = &HF2 CONST forw% = &HF1 CONST stopp% = &HF0 ' 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 GOSUB sendremote ' &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% GOSUB sendremote CASE "v" send% = forw% GOSUB sendremote CASE "z" send% = rew% GOSUB sendremote CASE "+" send% = plus% GOSUB sendremote CASE "-" send% = minus% GOSUB sendremote CASE "b" send% = bass% GOSUB sendremote CASE "d" send% = disp% GOSUB sendremote CASE "p" send% = mode% GOSUB sendremote CASE "w" GOSUB WriteTitle CASE "E" send% = &HF8 GOSUB sendremote CLS END END SELECT WEND ' end of main loop ' *************** subroutines ********************* sendremote: 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 RETURN WriteTitle: name$ = "" CLS PRINT CHR$(7) PRINT "Press MDs EDIT key for Track/Disk name" PRINT "Press MDs ENTER key for start input" PRINT "Please type in the name (max. 100 chars)" PRINT "---------- (Display length)" DO DO du$ = INKEY$ LOOP UNTIL du$ <> "" 'PRINT du$, 'a$ = du$ + " " 'PRINT ASC(a$) IF du$ = CHR$(8) THEN name$ = LEFT$(name$, LEN(name$) - 1): GOTO backout IF du$ = CHR$(13) THEN GOTO goon 'Filtering Characters and Numbers: IF (ASC(UCASE$(du$)) > 31 AND ASC(UCASE$(du$)) < 91) OR (ASC(du$) = 95 OR ASC(du$) = 96) THEN name$ = name$ + du$ backout: LOCATE , 1 PRINT name$ + " "; END IF LOOP UNTIL LEN(name$) = 100 goon: PRINT PRINT "Sending (look at Sharps display!)"; char% = 0 FOR i% = 1 TO LEN(name$) PRINT "."; oldchar% = char% display% = 0 du% = ASC(MID$(name$, i%, 1)) ' blank char IF du% = 32 THEN num% = 1: char% = 0: GOTO further ' Numbers 0 to 9 IF du% > 47 AND du% < 58 THEN num% = du% - 20: char% = 0: GOTO further ' Capitals A to Z IF du% > 64 AND du% < 91 THEN num% = du% - 63: char% = 0: GOTO further ' small chars a to z IF du% > 96 AND du% < 123 THEN display% = 1 num% = du% - 95 char% = 0 GOTO further END IF IF du% > 33 AND du% < 38 THEN num% = du% - 17: char% = 1: GOTO further ' all other chars: char% = 1 SELECT CASE du% CASE 33 ' ! num% = 14 CASE 38 ' & num% = 11 CASE 39 ' ' num% = 3 CASE 40 ' ( num% = 9 CASE 41 ' ) num% = 10 CASE 42 ' ) num% = 21 CASE 43 ' + num% = 7 CASE 44 ' , num% = 5 CASE 45 ' - num% = 6 CASE 46 ' . num% = 4 CASE 47 ' / num% = 2 CASE 58 ' : num% = 8 CASE 59 ' ; num% = 16 CASE 60 ' < num% = 12 CASE 61 ' = num% = 22 CASE 62 ' > num% = 13 CASE 63 ' ? num% = 15 CASE 64 ' @ num% = 23 CASE 95 ' _ num% = 24 CASE 96 ' ` num% = 25 END SELECT further: IF (char% = 1 AND oldchar% = 0) OR (char% = 0 AND oldchar% = 1) THEN PRINT CHR$(7) PRINT "Press Sharps Character key, any key on PC"; SLEEP END IF IF char% = 0 THEN IF num% <= 18 THEN FOR j% = 1 TO num% send% = plus% GOSUB sendremote NEXT j% ELSE num% = 38 - num% FOR j% = 0 TO num% send% = minus% GOSUB sendremote NEXT j% END IF END IF IF char% = 1 THEN IF num% <= 12 THEN FOR j% = 1 TO num% send% = plus% GOSUB sendremote NEXT j% ELSE num% = 26 - num% FOR j% = 0 TO num% send% = minus% GOSUB sendremote NEXT j% END IF END IF IF display% = 1 THEN send% = disp% GOSUB sendremote END IF send% = forw% GOSUB sendremote NEXT i% PRINT PRINT CHR$(7) PRINT "Press Enter on Sharp, then any key on PC"; SLEEP RETURN