1000 ! * CDLFD.BAC 1005 INTEGER : EXTEND 1010 ; '** Change LFD pointer **' 1020 ; ' Ver 1.00, 1985-11-29' 1030 ; ' Copyright 1984 Dataindustrier AB' 1040 ; 1050 ! * Written by Benny L|fgren 1060 ! ** ** ** ** ** ** ** ** ** ** ** 1070 ! * 1080 ! * Ver date / Ver nb / Sign / Note 1090 ! * 84-07-20 / X.00 / BL / Main 1100 ! * 85-01-31 / X.01 / GN / Bad lib address poke (+2) 1110 ! * 85-04-09 / X.02 / BL / NETCALL to talk to central 1120 ! * 85-04-09 / X.03 / BL / No loop if central trap 1130 ! * 85-04-09 / X.04 / BL / Correct physical drive setup 1140 ! * 85-04-09 / X.05 / BL / Can disable pointer 1150 ! * 85-04-24 / X.06 / BL / Accessible from DOS, FNStartpar$ handling 1160 ! * 85-11-29 / X.07 / BL / Nicer error handling 1170 ! * 85-11-29 / 1.00 / BL / Release 1180 ! * 1190 ! ** ** ** ** ** ** ** ** ** ** ** 1200 ! * 1210 ! EJECT 1220 ! ******************************** 1230 ! * 1240 ! * Main routine 1250 ! * 1260 A$=FNStartpar$ : IF A$='' GOTO 1280 1270 IF A$='-D' OR A$='-d' GOTO 1320 ELSE 1360 1280 INPUT "Directory: "A$ : IF LEN(A$) GOTO 1360 1290 ! 1300 INPUT "Do you want to disable LFD pointer (N)? "A$ 1310 IF CHR$(ASCII(FNCaps$(A$)))<>"Y" GOTO 1490 1320 Z=FNTalknet(14,8,255,0,0,31) ! Clear central LFD pointer 1330 IF FNCenerr(Z) GOTO 1490 1340 POKE PEEK2(24695),0,0,0 : GOTO 1490 1350 ! 1360 IF INSTR(1,A$,':')=0 Dr=255 : GOTO 1400 1370 Dr=FNDrsel(LEFT$(A$,INSTR(1,A$,':'))) : IF Dr GOTO 1390 1380 ; "Invalid drive." : GOTO 1280 1390 A$=RIGHT$(A$,INSTR(1,A$,':')+1) 1400 A$=FNCaps$(A$) : IF RIGHT$(A$,LEN(A$))<>"/" A$=A$+"/" 1410 A$=A$+CHR$(13) : Prg$=CHR$(1,Dr,0,195,24,96) 1420 Z=CALL(VARPTR(Prg$),VARPTR(A$)) ! Open file 1430 Z=FNTalknet(14,8,0,0,0,31) 1440 IF FNCenerr(Z) GOTO 1480 1450 Pdn=PEEK(-703) AND 31 : IF Pdn=27 OR Pdn=30 OR Pdn=31 Pdn=PEEK(-689) AND 31 1460 Libadr=PEEK2(-692) : POKE PEEK2(24695),Libadr,SWAP%(Libadr),Pdn 1470 ! 1480 MID$(Prg$,5,1)="!" : Z=CALL(VARPTR(Prg$)) ! Close file 1490 ; FNExit 1500 ! 1510 ! ********************************* 1520 ! * 1530 ! * Scan device table for disk 1540 ! * 1550 DEF FNDrsel(A$) LOCAL I,Dr$=3,Ptr 1560 IF RIGHT$(A$,LEN(A$))=":" Dr$=LEFT$(A$,LEN(A$)-1) ELSE Dr$=A$ 1570 Dr$=FNCaps$(Dr$) : WHILE LEN(Dr$)<3 : Dr$=Dr$+" " : WEND 1580 Ptr=PEEK2(65403) 1590 WHILE Ptr : I=0 1600 WHILE I<3 : I=I+1 1610 IF PEEK(Ptr+1+I)<>ASCII(RIGHT$(Dr$,I)) GOTO 1630 1620 WEND : GOTO 1650 1630 Ptr=PEEK2(Ptr) 1640 WEND : RETURN 0 ! Drive not found 1650 I=PEEK(Ptr+7) : IF I>3 RETURN I 1660 RETURN PEEK(PEEK2(24683))+I ! DR_: conversion 1670 FNEND 1680 ! 1690 ! ********************************* 1700 ! * 1710 ! * Convert lower case to caps 1720 ! * 1730 DEF FNCaps$(A$) LOCAL I,Str$=160,Char$=1 1740 WHILE I'_' AND Char$<'' Char$=CHR$(ASCII(Char$)-32) 1760 Str$=Str$+Char$ 1770 WEND : RETURN Str$ 1780 FNEND 1790 ! 1800 ! ********************************* 1810 ! * 1820 ! * Do communication with net central. 1830 ! * 1840 DEF FNTalknet(Fc,Sfc,B,C,D,E) LOCAL Z 1850 POKE 64798,255 ! 0FFH -> BSAVE. => TFT. fake (use DOSBUF0). 1860 POKE 64961,Fc ! FC -> MSG.FC (Function code). 1870 POKE 64962,Sfc ! SFC -> MSG.SFC (Subfunction code). 1880 POKE 64963,C,B ! MSG.PDN, MSG.ERRB (BC register to/from central). 1890 POKE 64965,E,D ! Register DE to/from central. 1900 Z=CALL(24615) ! NETCALL. => Talk to the central. 1910 RETURN PEEK(64962) 1920 FNEND 1930 ! 1940 ! ********************************* 1950 ! * 1960 ! * Check if user entered from DOS or BASIC 1970 ! * 1980 DEF FNChkdos LOCAL I 1990 I=PEEK2(65302)-160 2000 WHILE I<160 : IF PEEK2(I)=-212 RETURN -1 2010 IF PEEK(I)<>13 I=I+1 : WEND 2020 RETURN 0 2030 FNEND 2040 ! 2050 ! ********************************** 2060 ! * 2070 ! * Get start parameter string (if any) 2080 ! * 2090 DEF FNStartpar$ LOCAL Cmdsp,I,Cmd$=160 2100 Cmdsp=PEEK2(65302)-160 2110 WHILE I<160 : I=I+1 : IF PEEK(Cmdsp+I-1)=44 GOTO 2140 2120 IF PEEK(Cmdsp+I-1)=13 RETURN '' ! No startpar string 2130 WEND : RETURN '' ! No startpar string 2140 IF PEEK(Cmdsp+I)=255 I=I+1 ! Skip DOS-entry flag 2150 WHILE I<160 : IF PEEK(Cmdsp+I)=13 GOTO 2180 2160 IF PEEK(Cmdsp+I)<32 OR PEEK(Cmdsp+I)>127 RETURN '' 2170 Cmd$=Cmd$+CHR$(PEEK(Cmdsp+I)) : I=I+1 : WEND 2180 RETURN Cmd$ 2190 FNEND 2200 ! 2210 ! ************************************* 2220 ! * 2230 ! * Exit to DOS or BASIC 2240 ! * 2250 DEF FNExit LOCAL A$=21,A 2260 IF FNChkdos=0 GOTO 2310 ELSE CLOSE ! We MUST close ALL files!!! 2270 A$='CMDINT SYS'+CHR$(14,255,205,27,96,216,195,3,193) 2280 A=VARPTR(A$) 2290 IF CALL(A+11,A) ; "Can't load CMDINT.SYS, press any key for RESET!"; 2300 GET A$ : IF CALL(0) REM Just a miracle would get through here... 2310 END ! End to get out of a function is ugly but... 2320 FNEND 2330 ! 2340 ! ********************************** 2350 ! * 2360 ! * Show (central) error if there is any 2370 ! * 2380 DEF FNCenerr(Ecode) LOCAL I,A$=80 2390 IF Ecode=255 ; 'File not found!' : RETURN -1 2400 IF (Ecode AND 128)=0 RETURN 0 2410 I=Ecode AND 127 : RESTORE 2460 2420 READ A$ : WHILE I : READ A$ : I=I-1 : WEND : ; A$ : RETURN -1 2430 ! 2440 ! Usual DOS traps 2450 ! 2460 DATA 'CRC or AM error during read.' 2470 DATA 'CRC or AM error during write.' 2480 DATA 'Record format error.' 2490 DATA 'Record number out of range.' 2500 DATA 'Write protect violation.' 2510 DATA 'Delete or read protect violation.' 2520 DATA 'File space full.' 2530 DATA 'Drive off line.' 2540 DATA 'Disc write protect.' 2550 DATA 'Logical file not open.' 2560 DATA 'Invalid logical file number.' 2570 DATA 'Invalid drive number.' 2580 DATA 'Invalid trap number.' 2590 DATA 'Failure in system data.' 2600 DATA 'Invalid physical file number.' 2610 DATA '*** INVALID ERROR CODE' 2620 ! 2630 ! Here follows specific net error codes 2640 ! 2650 DATA 'Login please.' 2660 DATA 'You must be a superuser.' 2670 DATA 'Illegal subfunction code.' 2680 DATA 'Central task already running.' 2690 DATA 'Task not found.' 2700 DATA 'Can''t change directory.' 2710 DATA 'Bad login.' 2720 DATA 'Illegal terminal number.' 2730 DATA 'Login is not allowed at the moment.' 2740 DATA 'Can''t unmount this device.' 2750 DATA 'Someone is already exclusive.' 2760 FNEND