home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
64'er
/
64ER_CD.iso
/
s85xx
/
s8505.d64
/
formel-druck
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
1995-03-30
|
8KB
|
368 lines
10 REM ********************************
20 REM * *
30 REM * FORMEL-DRUCK *
40 REM * *
50 REM * 1985 BY PATRICK BOEDEKER *
60 REM * NEUSTR. 11 *
70 REM * 4350 RECKLINGHAUSEN *
80 REM * *
90 REM ********************************
100 :
110 :
120 DIMF$(50)
130 DIMG$(18)
140 G$(1)="1/X"
150 G$(2)="X^2"
160 G$(3)="EXP(X)"
170 G$(4)="SQR(X)"
180 G$(5)="SQR(EXP(X))"
190 G$(6)="EXP(SQR(X))"
200 G$(7)="SQR(X^(3*X+4))"
210 G$(8)="1/(7*X^6+3*X^2)"
220 G$(9)="(3*X^2-2*X+4)/(5*X^3+2*X-12)"
230 G$(10)="3*X^2-2*X+4/(5*X^3+2*X-12)"
240 G$(11)="(3*X^2-2*X+4)/5*X^3+2*X-12"
250 G$(12)="3*X^2-2*X+4/5*X^3+2*X-12"
260 G$(13)="(3*X^(7*X+4))/(2*X^2-7*X+2)"
270 G$(14)="EXP(X)+SQR(X^4+X^3+X^2)/7*X^3+14"
280 G$(15)="(X^SQR(3*X+4)+SQR(X^4+3))/7"
290 G$(16)="EXP(X)/SQR(X^3+4*X)+SQR(3*X)-1/X^2"
300 G$(17)="3/4*(7*X^2-3*X)+(7*X^2)/(14*X^3)"
310 G$(18)="SQR(X^23-4)+1/(3+X)-SQR(2*X^3)+1/X"
1000 OPEN1,4,8
1010 PRINT#1," BASIC ";
1020 PRINT#1," FORMEL-DRUCK"
1030 PRINT#1:CLOSE1
1040 FORA=1TO18
1050 OPEN1,4
1060 PRINT#1:PRINT#1
1070 PRINT#1,CHR$(27)" T"
1080 PRINT#1," [194]EISPIEL";A;" : ";
1090 PRINT#1,CHR$(27)" G";
1100 PRINT#1,G$(A);
1110 CLOSE1
1120 BB=55:F$=G$(A):GOSUB50000
1130 NEXTA
1140 OPEN1,4,4:PRINT#1,CHR$(12):CLOSE1
1150 END
1160 :
1170 :
50000 REM *****************************
50010 REM * *
50020 REM * AUSGABE VON MATHEMATI- *
50030 REM * SCHEN FORMELN IN BRUCH-, *
50040 REM * WURZEL- UND POTENZ- *
50050 REM * SCHREIBWEISE AUF DEN *
50060 REM * DRUCKER FX-80 MIT *
50070 REM * GOERLITZ INTERFACE. *
50080 REM * *
50090 REM * DIE FUNKTION MUSS IN F$, *
50100 REM * DER ABSTAND VOM LINKEN *
50110 REM * RAND IN BB UEBERGEBEN *
50120 REM * WERDEN *
50130 REM *****************************
50140 :
50150 :
50160 GOTO50180
50170 T$=MID$(FU$,T,1):RETURN
50180 OPEN1,4:OPEN2,4,10,"7"
50230 :
50240 REM *********************
50250 REM * ZEICHENDEFINITION *
50260 REM *********************
50270 :
50280 PRINT#1,CHR$(27);":";CHR$(0);CHR$(0);CHR$(0);
50290 PRINT#1,CHR$(27);"&";CHR$(0);"%%";CHR$(139);
50300 PRINT#1,CHR$(0);CHR$(4);CHR$(4);CHR$(3);CHR$(2);CHR$(4);
50310 PRINT#1,CHR$(8);CHR$(16);CHR$(32);CHR$(64);CHR$(128);CHR$(0);
50320 PRINT#1,CHR$(27);"&";CHR$(0);"&&";CHR$(139);
50330 PRINT#1,CHR$(128);CHR$(128);CHR$(128);CHR$(128);CHR$(128);CHR$(128);
50340 PRINT#1,CHR$(128);CHR$(128);CHR$(128);CHR$(128);CHR$(128);CHR$(0);
50350 PRINT#1,CHR$(27);"%";CHR$(1);CHR$(0);
50360 FU$=F$
50370 SC=0:Y=0
50390 PRINT#1,CHR$(27);"E";
50400 L=LEN(FU$)
50410 :
50420 REM ***********************
50430 REM * EXPONENTIALFUNKTION *
50440 REM ***********************
50450 :
50460 I=1
50470 T=I:GOSUB50170
50480 IFT$="E"THEN50520
50490 I=I+1
50500 IFI<=LTHEN50470
50510 GOTO50620
50520 FORR=ITOI+2
50530 T=R:GOSUB50170
50540 E$=E$+T$:NEXTR
50550 IFE$="EXP"THENFU$=LEFT$(FU$,I-1)+"E^"+RIGHT$(FU$,L-I-2):L=L-1
50560 E$="":GOTO50490
50570 :
50580 REM ******************
50590 REM * WURZELFUNKTION *
50600 REM ******************
50610 :
50620 I=1
50630 T=I:GOSUB50170
50640 IFT$="S"THEN50680
50650 I=I+1
50660 IFI<=LTHEN50630
50670 GOTO50780
50680 FORR=ITOI+2
50690 T=R:GOSUB50170
50700 E$=E$+T$:NEXTR
50710 IFE$="SQR"THENFU$=LEFT$(FU$,I-1)+"%"+RIGHT$(FU$,L-I-2):L=L-2
50720 E$="":GOTO50650
50730 :
50740 REM *****************************
50750 REM *GEBROCHENRATIONALE FUNKTION*
50760 REM *****************************
50770 :
50780 I=1:KL=0
50790 T=I:GOSUB50170
50800 IFT$="("THENKL=KL+1
50810 IFT$=")"THENKL=KL-1
50820 IFT$="/"ANDKL>0THEN50840
50830 IFT$="/"THEN50980
50840 I=I+1
50850 IFI<=LTHEN50790
50860 :
50870 REM **************************
50880 REM * GANZRATIONALE FUNKTION *
50890 REM **************************
50900 :
50910 SC=SC+1:F$(SC)=FU$
50920 GOTO51320
50930 :
50940 REM *******************
50950 REM * FAKTORZERLEGUNG *
50960 REM *******************
50970 :
50980 WR=I:KL=0
50990 WR=WR-1:T=WR:GOSUB50170
51000 IFT$=")"THENKL=KL+1
51010 IFT$="("THENKL=KL-1
51020 IFT$="+"ANDKL=0THEN51070
51030 IFT$="-"ANDKL=0THEN51070
51040 IFT$="*"ANDKL=0THEN51070
51050 IFWR=1THENWR=0:GOTO51070
51060 GOTO50990
51070 WR=I-WR-1
51080 WV=I
51090 WV=WV+1:T=WV:GOSUB50170
51100 IFT$="("THENKL=KL+1
51110 IFT$=")"THENKL=KL-1
51120 IFT$="+"ANDKL=0THENWV=WV-1:GOTO51170
51130 IFT$="-"ANDKL=0THENWV=WV-1:GOTO51170
51140 IFT$="*"ANDKL=0THENWV=WV-1:GOTO51170
51150 IFWV=LTHEN51170
51160 GOTO51090
51170 WV=WV-I
51180 IFKL<0THENWV=WV-1
51190 SC=SC+1
51200 F$(SC)=LEFT$(FU$,I-1-WR)
51210 FU$=RIGHT$(FU$,L-I+WR+1)
51220 SC=SC+1
51230 F$(SC)=LEFT$(FU$,WR+WV+1)
51240 F$(SC+1)=RIGHT$(FU$,L-I-WV)
51250 FU$=RIGHT$(FU$,L-I-WV):L=LEN(FU$)
51260 GOTO50780
51270 :
51280 REM ************
51290 REM * SCHLEIFE *
51300 REM ************
51310 :
51320 Y=Y+1
51330 IFY>SCTHEN53150
51340 IFF$(Y)=""THEN51320
51350 FU$=F$(Y)
51360 CLOSE4:OPEN4,4,4
51370 PRINT#4,CHR$(27);CHR$(108);CHR$(BB);
51380 PRINT#4,CHR$(27);"E";
51390 CLOSE2:OPEN2,4,10,"7"
51400 :
51410 REM ***********
51420 REM * BRUCH ? *
51430 REM ***********
51440 :
51450 L=LEN(FU$)
51460 I=1:KL=0
51470 T=I:GOSUB50170
51480 IFT$="("THENKL=KL+1
51490 IFT$=")"THENKL=KL-1
51500 IFT$="/"ANDKL>0THEN51520
51510 IFT$="/"THEN51650
51520 I=I+1
51530 IFI<=LTHEN51470
51540 :
51550 REM **************
51560 REM * KEIN BRUCH *
51570 REM **************
51580 :
51590 OB$=FU$:UB$="":LO=L:BB=BB+L:GOTO52110
51600 :
51610 REM *************
51620 REM * ZERLEGUNG *
51630 REM *************
51640 :
51650 OB$=""
51660 FORJ=1TOI-1:T=J:GOSUB50170
51670 OB$=OB$+T$:NEXTJ:LO=LEN(OB$)
51680 IFLEFT$(OB$,1)="("ANDRIGHT$(OB$,1)=")"THENOB$=MID$(OB$,2,LEN(OB$)-2):LO=LO-2
51690 UB$=""
51700 FORJ=I+1TOL:T=J:GOSUB50170
51710 UB$=UB$+T$:NEXTJ:LU=LEN(UB$)
51720 IFLEFT$(UB$,1)="("ANDRIGHT$(UB$,1)=")"THENUB$=MID$(UB$,2,LEN(UB$)-2):LU=LU-2
51730 :
51740 REM ****************
51750 REM * POTENZANZAHL *
51760 REM ****************
51770 :
51780 Z=0:WO=0:WU=0
51790 I=0:KL=0:Z=Z+1
51800 I=I+1
51810 IFZ=1THENT$=MID$(OB$,I,1)
51820 IFZ=2THENT$=MID$(UB$,I,1)
51830 IFT$="^"THEN51870
51831 IFZ=1ANDT$="%"THENWO=WO+2
51832 IFZ=2ANDT$="%"THENWU=WU+2
51840 IFZ=1ANDI<LOTHEN51800
51850 IFZ=2ANDI<LUTHEN51800
51860 GOTO52000
51870 IFZ=1THENT$=MID$(OB$,I,1)
51880 IFZ=2THENT$=MID$(UB$,I,1)
51890 IFT$="("THENKL=KL+1
51900 IFT$=")"ANDKL=0THEN51800
51910 IFT$=")"ANDKL>0THENKL=KL-1
51920 IFT$="+"ANDKL=0THEN51800
51930 IFT$="-"ANDKL=0THEN51800
51940 IFT$="*"ANDKL=0THEN51800
51945 IFT$="/"ANDKL=0THEN51800
51950 I=I+1
51960 IFT$=""THEN52000
51970 IFZ=1THENWO=WO+.5:IFT$="^"THENWO=WO+.5
51980 IFZ=2THENWU=WU+.5:IFT$="^"THENWU=WU+.5
51990 GOTO51870
52000 IFZ=1THEN51790
52030 IFLO-WO+1.5<LU-WUTHENOB$=" "+OB$+" ":LO=LO+2:D=1:GOTO52030
52040 IFD=1THEND=0:GOTO52060
52050 IFLU-WU+1.5<LO-WOTHENUB$=" "+UB$+" ":LU=LU+2:GOTO52050
52060 :
52070 REM *******************
52080 REM * ZAEHLER DRUCKEN *
52090 REM *******************
52100 :
52110 M=0
52120 PRINT#1,CHR$(27);"E";
52130 IFUB$<>""THENPRINT#4,CHR$(27);CHR$(106);CHR$(22);:CLOSE3:OPEN3,4,10,"7"
52140 O=1:Z=1
52150 T=O:T$=MID$(OB$,T,1)
52160 IFT$="^"THENE=O:GOSUB52580:O=E:M=M+1
52170 IFT$="%"THENQ=O:GOSUB52910:O=Q
52180 IFS=1THENS=0:GOTO52200
52190 PRINT#1,T$;
52200 O=O+1
52210 IFO<=LOTHEN52150
52220 IFUB$=""THENPRINT#1:PRINT#4,CHR$(27);CHR$(106);CHR$(21):CLOSE3:OPEN3,4,10,"7"
52225 IFUB$=""THENBB=BB-INT(M-.5):GOTO51320
52230 :
52240 REM ***************
52250 REM * BRUCHSTRICH *
52260 REM ***************
52270 :
52280 CLOSE3:OPEN3,4,9,"7"
52290 PRINT#3
52300 IFLO-WO<=LU-WUTHENAA=LU-WU+.5
52310 IFLO-WO>=LU-WUTHENAA=LO-WO+.5
52320 FORI=1TOINT(AA)
52330 PRINT#3,"[192]";:NEXTI
52340 PRINT#3
52350 CLOSE3:OPEN3,4,10,"7"
52360 BB=BB+INT(AA+1)
52370 :
52380 REM ******************
52390 REM * NENNER DRUCKEN *
52400 REM ******************
52410 :
52420 U=1:Z=2
52430 T=U:T$=MID$(UB$,T,1)
52440 IFT$="^"THENE=U:GOSUB52580:U=E
52450 IFT$="%"THENQ=U:GOSUB52910:U=Q
52460 IFS=1THENS=0:GOTO52480
52470 PRINT#1,T$;
52480 U=U+1
52490 IFU<=LUTHEN52430
52500 PRINT#1
52510 PRINT#4,CHR$(27);CHR$(106);CHR$(40);
52520 GOTO51320
52530 :
52540 REM ******************
52550 REM * POTENZAUSDRUCK *
52560 REM ******************
52570 :
52580 CLOSE3:OPEN3,4,9,"7"
52590 PRINT#1,CHR$(27);"F";
52600 PRINT#1,CHR$(27);"S";CHR$(0);CHR$(15);
52610 E=E+1
52620 T=E
52630 IFZ=1THENT$=MID$(OB$,T,1):AO=AO+.5
52640 IFZ=2THENT$=MID$(UB$,T,1):AU=AU+.5
52645 IFT$="%"THENQ=E:PP=0:GOSUB52910:E=Q:M=M+PP
52650 IFT$="("THENEK=EK+1
52660 IFT$=")"ANDEK=0THEN52810
52670 IFT$=")"ANDEK>0THENEK=EK-1
52680 IFT$="+"ANDEK=0THEN52810
52690 IFT$="-"ANDEK=0THEN52810
52700 IFT$="*"ANDEK=0THEN52810
52705 IFT$="/"ANDEK=0THEN52810
52710 PRINT#1,T$;
52720 IFWW=1THENPRINT#4,CHR$(27);CHR$(106);CHR$(3);:CLOSE3:OPEN3,4,10,"7"
52730 IFWW=1THENPRINT#1,CHR$(8);
52740 IFWW=1THENPRINT#1,"&";
52750 IFWW=1THENPRINT#4,CHR$(27);CHR$(74);CHR$(3);:CLOSE3:OPEN3,4,9,"7"
52760 M=M+.5
52770 IFZ=1ANDE=LOTHENS=1:GOTO52810
52780 IFZ=2ANDE=LUTHENS=1:GOTO52810
52790 E=E+1
52800 GOTO52620
52810 PRINT#4,CHR$(27);CHR$(84);CHR$(18);
52820 EK=0
52830 PRINT#1,CHR$(27);"E";
52840 CLOSE3:OPEN3,4,10,"7"
52850 RETURN
52860 :
52870 REM ******************
52880 REM * WURZELAUSDRUCK *
52890 REM ******************
52900 :
52910 PRINT#1,"%";:KL=1:Q=Q+1:WW=1:WM=0
52920 Q=Q+1
52930 T=Q
52940 IFZ=1THENT$=MID$(OB$,T,1)
52950 IFZ=2THENT$=MID$(UB$,T,1)
52960 IFT$="^"THENE=Q:GOSUB52580:Q=E:WM=WM+1
52970 IFS=1THENS=0:GOTO52920
52980 IFT$="("THENKL=KL+1
52990 IFT$=")"THENKL=KL-1
53000 IFT$=")"ANDKL=0THENS=1:GOTO53070
53010 PRINT#1,T$;
53015 PP=PP+.5
53020 PRINT#4,CHR$(27);CHR$(106);CHR$(3);:CLOSE3:OPEN3,4,10,"7"
53030 PRINT#1,CHR$(8);
53040 PRINT#1,"&";
53050 PRINT#4,CHR$(27);CHR$(74);CHR$(3);:CLOSE3:OPEN3,4,10,"7"
53060 GOTO52920
53070 WW=0
53080 M=M+WM+2
53090 RETURN
53100 :
53110 REM ********
53120 REM * ENDE *
53130 REM ********
53140 :
53150 PRINT#4,CHR$(27);"@";:CLOSE1:CLOSE2:CLOSE3:CLOSE4
53160 OPEN3,4,8,"12":CLOSE3
53170 RETURN