§ Исходный код

Когда мне было 12 лет, я на BASIC написал программу Norton Commander. Она была нерабочая, но очень классная для того меня. И я всю жизнь ее берегу как зеницу ока
Norton Commander УКНЦ в 12 лет

REM Сначала написать программочку

10 OPEN "DOS" FOR OUTPUT
20 PRINT #"1999 г.              NORTON COMMANDER  VALERA"
30 PRINT #0
40 CLOSE

RUN
NEW

10 CLS
20 WIDTH 80
30 DIM CAT¤(15),FIL(15),FIL¤(15,16),PROG(512,4),RASH¤(15,16)
40 OPEN "DOS" FOR INPUT
50 INPUT #FORM¤
60 PRINT FORM¤
70 INPUT #CAT
80 IF CAT=0 THEN 170
90 FOR I=1 TO CAT
100 INPUT #CAT¤(I)
110 INPUT #FIL(I)
120 FOR M=1 TO FIL(I)
130 INPUT #FIL¤(I,M+1)
140 INPUT #RASH¤(I,M+1)
150 FIL¤(I,1)=".."
155 RASH¤(I,1)=""
156 NEXT
160 NEXT
170 CLOSE
180 CLS
190 C=1
200 F=1
201 CATALOG=0
210 PRINT "+= A:> ===============================++================================+"
220 FOR I=1 TO 16
230 PRINT "|                                     ||                                |"
240 NEXT
250 PRINT "+=====================================++================================+"
270 IF CATALOG=0 THEN 330
280 FOR I=1 TO FIL(C)
290 PRINT AT(42,I); FIL¤(C,I)
300 PRINT AT(75,I); RASH¤(C,I)
310 NEXT
320 GOTO 360
330 FOR I=1 TO CAT
340 PRINT AT(1,I); CAT¤(I)
350 NEXT
360 ="                                        "
370 PRINT AT(0,19); "A:>"
380 PRINT AT(0,21); "0-РЕДАКТИРОВАНИЕ, 1-НОВКАТ, 2-КОП, 3-ПЕРЕИМ, 4-ВЫХОД"
390 COLOR 0,7
400 IF CATALOG=0 THEN 440
410 PRINT AT(41,F); FIL¤(C,F); MID¤(,1,39-LEN(FIL¤(C,F)))
420 GOTO 450
440 PRINT AT(1,C); CAT¤(C); MID¤(,1,39-LEN(CAT¤(C)))
450 COLOR 7,0
460 =INKEY¤
470 IF ="" THEN 460
480 IF ="A" OR ="B" OR ="C" OR ="D" OR =CHR¤(13) THEN 520
490 GOSUB 3000: REM FUNCTION
500 IF ="4" THEN 1080
510 GOTO 180
520 IF ="A" THEN 670
530 IF ="B" THEN 750
540 IF ="C" OR ="D" THEN 830
550 IF =CHR¤(13) THEN 930
560 PRINT AT(0,19)
570 INPUT "ИМЯ ФАЙЛА"; FILES¤
580 FOR I=1 TO CAT
590 FOR M=1 TO FIL(I)
600 IF FIL¤(I,M)=FILES¤ THEN 650
610 NEXT
620 NEXT
630 PRINT AT(0,20); "AT DISK NO FILE"
640 GOTO 180
650 GOSUB 3000: REM ЗАПРОС ПРОГРАММНЫЙ РЕДАКТОР
660 GOTO 180
670 IF ="A" AND CATALOG=0 AND C=1 THEN 460
680 IF ="A" AND CATALOG=0 AND C>1 THEN 710
690 IF ="A" AND CATALOG=1 AND F=1 THEN 460
700 IF ="A" AND CATALOG=1 AND F>1 THEN 730
710 C=C-1
720 GOTO 270
730 F=F-1
740 GOTO 270
750 IF ="B" AND CATALOG=0 AND C=15 THEN 460
760 IF ="B" AND CATALOG=0 AND C<15 THEN 790
770 IF ="B" AND CATALOG=1 AND F=15 THEN 460
780 IF ="B" AND CATALOG=1 AND F<15 THEN 810
790 C=C+1
800 GOTO 270
810 F=F+1
820 GOTO 270
830 IF CATALOG=0 THEN 850
840 IF CATALOG=1 THEN 890
850 CATALOG=1
860 CLS
870 F=1
880 GOTO 210
890 CATALOG=0
900 C=1
910 CLS
920 GOTO 210
930 IF CATALOG=1 AND FIL¤(C,1)=".." THEN 1010
940 IF CATALOG=0 THEN 960
950 GOTO 1050
960 IF CAT¤(C)="" THEN 460
970 F=1
980 CATALOG=1
990 CLS
1000 GOTO 270
1010 CATALOG=0
1020 C=1
1030 CLS
1040 GOTO 270
1050 FILES¤=FIL¤(C,F)
1060 GOSUB 5000
1070 GOTO 180
1080 OPEN "DOS" FOR OUTPUT
1090 PRINT #FORM¤
1100 PRINT #CAT
1110 FOR I=1 TO CAT
1120 PRINT #CAT¤(I)
1130 PRINT #FIL(I)
1140 FOR M=1 TO FIL(I)
1150 PRINT #FIL¤(I,M)
1160 PRINT #RASH¤(I,M)
1170 NEXT
1180 NEXT
1190 CLOSE
1200 CLS
1300 END

3000 IF ="0" THEN 3610
3005 IF ="1" THEN 4110
3010 IF ="2" THEN 4480
3020 IF ="3" THEN 5310
3030 GOTO 4400
3040 PRINT AT(30,10); "+===================+"
3050 PRINT AT(30,11); "| ФАЙЛ:             |"
3060 PRINT AT(30,12); "+===================+"
3070 =""
3080 PRINT AT(36+LEN(),11); 
3090 =INKEY¤
3100 IF ="" THEN 3090
3110 =+
3115 GOTO 3080
3120 FOR I=1 TO CAT
3121 FOR M=1 TO FIL(I)
3122 IF FIL¤(I,M)= THEN 3126
3123 NEXT
3124 NEXT
3125 GOTO 3250
3126 FILE¤=: PRINT AT(0,22); "ВЫХОД В NORTON COMMANDER"
3130 OPEN FILE¤ FOR INPUT
3140 INPUT #CKOLKO
3150 FOR I=1 TO CKOLKO
3160 INPUT #PROG(I-INT(I/512)*512,INT(I/512)+1)
3170 PRINT AT(I-INT(I/79)*79, INT(I/79)+1); CHR¤(PROG(I-INT(I/512)*512,INT(I/512)+1))
3180 NEXT
3190 CLOSE
3200 PRINT AT(0,0); "+====================================================+"
3210 PRINT AT(12,0);"ФАЙЛ:"; FILE¤
3220 X=1
3230 Y=1
3240 GOTO 3290
3250 OPEN  FOR OUTPUT
3260 PRINT #0
3270 CLOSE
3280 GOTO 3125
3290 PRINT AT(X,Y); "_"
3300 PRINT AT(X,Y); CHR¤(PROG(X,Y))
3310 =INKEY¤: IF ="" THEN 3310
3320 IF ="A" AND Y=1 THEN 3290
3330 IF ="B" AND Y=21 THEN 3290
3340 IF ="D" AND X=1 THEN 3290
3350 IF ="C" AND X=78 THEN 3290
3360 IF =CHR¤(13) THEN GOTO 3480
3370 IF ="A" THEN Y=Y-1
3380 IF ="B" THEN Y=Y+1
3390 IF ="D" THEN X=X-1
3400 IF ="C" THEN X=X-1
3410 IF ="A" OR ="B" OR ="C" OR ="D" THEN 3290
3420 PRINT AT(X,Y); 
3430 FOR I=1 TO 255
3440 IF =CHR¤(I) THEN 3460
3450 NEXT
3460 PROG(X,Y)=I
3470 GOTO 3190
3480 OPEN FILE¤ FOR OUTPUT
3490 PRINT #(Y*78+X)-78*INT((Y*78+X)/78),INT((Y*78+X)/512)+1)
3500 FOR I=1 TO Y
3510 FOR M=1 TO X
3520 PRINT #PROG(M,I)
3530 NEXT
3540 NEXT
3550 CLOSE
3560 FIL¤(C,F+1)=FILE¤: RASH¤(C,F+1)="TXT"
3570 F=F+1
3580 FIL(C)=F
3590 CATALOG=1
3600 FOR I=1 TO 4: FOR M=1 TO 512: PROG(M,I)=0: NEXT: NEXT: RETURN
3610 PRINT AT(0,20);
3620 INPUT "TXT,EXE,ВЫХ"; A1¤
3630 IF A1¤="TXT" THEN 3040
3640 IF A1¤="EXE" THEN 3660
3650 IF A1¤="ВЫХ" THEN RETURN
3660 PRINT AT(0,20);
3670 INPUT "       ИМЯ ФАЙЛ"; NAME¤
3680 FOR I=1 TO CAT
3685 FOR M=1 TO FIL(I)
3688 IF FIL¤(I,M)=NAME¤ THEN 3740
3690 NEXT
3700 NEXT
3710 OPEN NAME¤ FOR OUTPUT
3720 PRINT #0
3730 CLOSE
3740 OPEN NAME¤ FOR INPUT
3750 INPUT #CKOLKO
3760 IF CKOLKO=0 THEN 3820
3770 FOR I=1 TO CKOLKO
3780 FOR M=1 TO 4
3790 INPUT #PROG(I,M)
3800 NEXT
3810 NEXT
3830 C1=1: M=0: PRINT "A-ВВЕРХ, B-ВНИЗ, C-РЕДАКТИРОВАНИЕ, D-ЗАПИСЬ, F-ВЫХОД"
3840 FOR I=0 TO C1+20: M=M+1: IF PROG(I,1)=0 THEN P=P+1: IF F=1 THEN R1=I
3850 PRINT AT(2,M); PROG(I,1)
3860 PRINT AT(6,M); PROG(I,2)
3870 PRINT AT(10,M); PROG(I,3)
3880 PRINT AT(14,M); PROG(I,4)
3890 NEXT: IF MORT=1 THEN 4100
3900 M=0
3910 P=0
3914 IF G=20 THEN P1=1
3915 G=G+1
3916 FOR I=1 TO 4
3920 PRINT AT(0,21);
3930 INPUT "ЧИСЛО"; TH
3940 PRINT AT(2+(I-1)*4,6); TH
3950 NEXT
3960 =INKEY¤
3970 IF ="" THEN 3960
3980 IF ="A" THEN GOTO 4040
3990 IF ="B" THEN GOTO 4080
4000 IF ="C" THEN 4120
4010 IF ="D" THEN 4170
4020 IF ="E" THEN 4230
4030 GOTO 3480
4040 C1=C1-1
4050 GOTO 3040
4060 C1=C1+1: MORT=1
4070 GOTO 3840
4080 IF P1=1 THEN 3916
4090 GOTO 3915
4100 MORT=0
4110 GOTO 3960
4120 PRINT AT(0,21); "СТРОКА, СТОЛБЕЦ"
4130 INPUT CTPOKA,CTOLBEC
4140 INPUT "ЧИСЛО ";TH
4150 PROG(CTOLBEC,CTPOKA)=TH
4160 GOTO 3914
4170 OPEN NAME¤ FOR OUTPUT
4180 PRINT #C1+G,4
4190 FOR I=1 TO C1+G
4200 FOR M=1 TO 4
4210 PRINT #PROG(I,M)
4220 NEXT
4230 NEXT
4235 CLOSE
4236 F=F+1
4237 FIL¤(C,F)=NAME¤
4238 RASH¤(C,F)="EXE"
4239 FIL(C)=F
4240 RETURN

4250 FOR I=1 TO 4
4260 FOR M=1 TO 512
4370 PROG(I,M)=0
4380 NEXT
4390 NEXT
4400 RETURN

4410 PRINT AT(0,18);
4420 INPUT "ИМЯ КАТАЛОГА";COT¤
4430 CAT=CAT+1: C=C+1
4440 CAT¤(CAT)=COT¤
4450 FIL¤(C,1)=".."
4460 FIL(C)=1
4470 RETURN

4480 CLS
4490 PRINT "ИМЯ ФАЙЛА ";: INPUT NAME¤
4500 PRINT "ВЫБЕРИТЕ ДИСКЕТУ НА КОТОРУЮ КОПИРУЮ"
4501 OPEN NAME¤ FOR INPUT
4502 INPUT #KOLBO,G1
4503 FOR I=1 TO G1-1
4504 FOR M=1 TO 512
4505 INPUT #PROG(M,I)
4506 NEXT
4507 NEXT
4508 FOR I=G1 TO C1: FOR M=1 TO KOLBO: INPUT #PROG(M,I): NEXT: NEXT
4509 CLOSE
4510 PRINT "ВСТАВИЛИ? (Д/Н)"
4520 =INKEY¤
4630 IF ="D" THEN 4660
4640 IF ="N" THEN 4750
4650 GOTO 4620
4660 OPEN NAME¤ FOR OUTPUT
4670 PRINT #KOLBO
4680 FOR I=1 TO 4
4690 FOR M=1 TO KOLBO
4700 PRINT #PROG(M,I)
4710 PROG(M,I)=0
4720 NEXT
4730 NEXT
4740 GOTO 180
4750 PRINT "1-УДАЛ, 2-ВОССТАНОВИТЬ, 3-ФОРМАТИРОВАТЬ, 4-ВЫХ"
4760 =INKEY¤
4770 IF ="1" THEN 4800
4780 IF ="4" THEN RETURN
4785 IF ="2" THEN 4870
4786 IF ="3" THEN 4920
4790 GOTO 4760
4800 IF F=1 THEN 4750
4810 FOR I=F TO FIL(C)-1
4820 FIL(C,I)=FIL(C,I+1)
4830 FIL(C,I+1)=""
4840 NEXT
4850 FIL(C)=FIL(C)-1
4860 RETURN

4870 INPUT "ВОССТАНОВИТЬ КАКОЙ ФАЙЛ, РАСШИРЕНИЕ ";FILEM¤,RASH¤
4880 F=F+1
4890 FIL¤(C,F)=FILEM¤
4900 RASH¤(C,F)=RASH¤
4910 RETURN

4920 OPEN "DOS" FOR OUTPUT
4930 PRINT #"1999 г.              NORTON COMMANDER  VALERA"
4940 PRINT #0
4950 CLOSE
4960 FOR I=1 TO CAT
4970 FOR M=1 TO FIL(I)
4980 OPEN FIL¤(I,M) FOR OUTPUT
5000 PRINT #0
5010 CLOSE
5020 NEXT
5030 NEXT: CAT=0: F=0: C=0
5040 FOR I=1 TO 15
5050 CAT¤(I)=""
5060 FIL(I)=0
5070 NEXT
5080 FOR I=1 TO 15
5090 FOR M=1 TO 16
5100 FIL¤(I,M)=""
5110 RASH¤(I,M)=""
5120 NEXT
5130 NEXT
5140 FOR I=1 TO 4
5150 FOR M=1 TO 512
5160 PROG(M,I)=0
5170 NEXT
5180 NEXT
5190 CATALOG=0
5200 RETURN

5300 CLS
5310 INPUT "СТАРОЕ ИМЯ "; CTNAM¤
5320 INPUT "НОВОЕ ИМЯ "; NONAME¤
5330 IF CTNAM¤="" THEN 5420
5340 GOTO 5360
5350 FIL¤(C,F)=NONAME¤
5360 OPEN FIL¤(C,F) FOR INPUT
5370 FOR I=1 TO 4
5380 FOR M=1 TO 512
5390 INPUT #
5400 NEXT
5410 NEXT
5420 PRINT "ФУНКЦИЯ НЕДОСТУПНА!"
5430 RETURN

6000 IF RASH¤(C,F)="TXT" THEN 6020
6010 IF RASH¤(C,F)="EXE" THEN 6030
6020 CLS
6030 PRINT "ЗАГРУЗКА УТИЛИТЫ РЕДАКТИРОВАНИЯ"
6040 FOR I=1 TO 2048*2
6050 NEXT: CLS
6060 F=1
6070 GOSUB 3000
6080 RETURN

6090 OPEN FIL¤(C,F) FOR INPUT
6100 INPUT #KOLBO,C1
6110 FOR I=1 TO KOLBO
6120 FOR M=1 TO 4
6130 INPUT #PROG(I,M)
6140 NEXT
6150 NEXT
6160 CLOSE
6161 I=1
6162 IF I>KOLBO THEN 6370
6180 IF PROG(I,2)=0 THEN 6330
6190 IF PROG(I,2)=1 THEN CLS
6200 IF PROG(I,2)=2 THEN PRINT CHR¤(PROG(I,3)); CHR¤(PROG(I,4));
6210 IF PROG(I,2)=3 THEN I=PROG(I,3)
6220 IF PROG(I,2)=4 THEN LOCATE PROG(PROG(I,3),4), PROG(PROG(I,4), 4)
6230 IF PROG(I,2)=5 THEN PROG(PROG(I,3),4) = PROG(PROG(I,4),4) + PROG(PROG(I+1,3),4)
6240 IF PROG(I,2)=6 THEN PROG(PROG(I,3),4) = PROG(PROG(I,4),4) - PROG(PROG(I+1,3),4)
6250 IF PROG(I,2)=7 THEN PROG(PROG(I,3),4) = PROG(PROG(I,4),4) * PROG(PROG(I+1,3),4)
6260 IF PROG(I,2)=8 THEN PROG(PROG(I,3),4) = PROG(PROG(I,4),4) / PROG(PROG(I+1,3),4)
6270 IF PROG(I,2)=9 THEN IF PROG(PROG(I,3),4) = PROG(PROG(I,4),4) THEN I=PROG(I+1,3)
6280 IF PROG(I,2)=10 THEN IF PROG(PROG(I,3),4) < PROG(PROG(I,4),4) THEN I=PROG(I+1,3)
6290 IF PROG(I,2)=11 THEN IF PROG(PROG(I,3),4) > PROG(PROG(I,4),4) THEN I=PROG(I+1,3)
6300 IF PROG(I,2)=12 THEN I=PROG(I,3)
6310 IF PROG(I,2)=13 THEN LINE(PROG(I,3),PROG(I,4))-(PROG(I+1,3),PROG(I+1,4)),PROG(I+2,3)
6320 IF PROG(I,2)=14 THEN BEEP
6340 IF PROG(I,2)=15 THEN PRINT CHR¤(PROG(PROG(I,3)),4); CHR¤(PROG(PROG(I,4),4);
6350 IF PROG(I,2)=16 THEN PRINT PROG(PROG(I,3),4);
6360 GOTO 6160
6370 RETURN