5 IF PEEK (104) < > 68 THEN POKE 17408,0: POKE
104,68: PRINT CHR$ (4);"RUN SHUTTER"
7 PRINT CHR$ (4);"BLOAD ROM"
10 GOSUB 10000
20 GOSUB 2000
60 GOSUB 1000
65 CH% = PEEK ( - 16384): IF CH% > 127 THEN GOSUB 5000: GOTO
60
70 GOSUB 2000: GOSUB 8000
80 GOTO 60
90 END
700 REM CALCULATE AND PRINT ONE NUMBER
710 VTAB VT%
720 HTAB (H%)
725 IF (IN / SC) > 32767 GOTO 900
730 S1% = INT (IN / SC)
740 IF ERR > 0 GOTO 900
745 IF S1% < > 0 THEN GOTO 750
746 J% = 1: GOTO 760
750 J% = INT ( LOG (S1%) / LG) + 1
760 IF J% > EX% THEN GOTO 900
790 IF J% = EX% THEN GOTO 840
800 FOR I = 1 TO EX% - J%
810 IF K = 0 THEN PRINT " ";
820 IF K = 1 THEN PRINT "0";
830 NEXT
840 IF S1% > 0 THEN GOTO 880
850 IF K = 0 THEN PRINT " ";
860 IF K = 1 THEN PRINT "0";
870 RETURN
880 PRINT S1%;:K = 1
890 RETURN
900 FOR I = 1 TO EX%: PRINT "*";: NEXT
910 RETURN
1000 REM READ SENSOR
1010 CALL 16384
1015 CH% = PEEK ( - 16384)
1016 IF CH% > 127 THEN RETURN
1020 ERR = PEEK (V2%)
1030 O1M% = PEEK (VS%)
1031 O2L% = PEEK (1 + VS%)
1032 C1E% = PEEK (2 + VS%)
1033 C2M% = PEEK (3 + VS%)
1034 C3L% = PEEK (4 + VS%)
1035 O3M% = PEEK (V1%)
1036 O4L% = PEEK (1 + V1%)
1037 C4E% = PEEK (2 + V1%)
1038 C5M% = PEEK (3 + V1%)
1039 C6L% = PEEK (4 + V1%)
1100 O1 = O1M% * 256 + O2L%
1101 C1 = C1E% * 65536 + C2M% * 256 + C3L%
1102 O2 = O3M% * 256 + O4L%
1103 C2 = C4E% * 65536 + C5M% * 256 + C6L%
1111 IF O1 < > O2 GOTO 1116: REM CORRECT FOR SOFTWARE
JITTER
1112 C1 = C1 + 1.125:C2 = C2 + 1.125
1113 IF C1 = C2 GOTO 1130
1114 IF C1 < C2 THEN C2 = C2 + 1.250: GOTO 1130
1115 C1 = C1 + 1.312: GOTO 1130
1116 IF O2 < O1 GOTO 1124
1117 O2 = O2 + 1.562:C1 = C1 + 1.562:C2 = C2 + 1.562
1118 IF O2 = C1 THEN C2 = C2 + 2.312: GOTO 1130
1119 IF O2 > C1 THEN C2 = C2 + 2.562:O2 = O2 + .938: GOTO 1130
1120 C1 = C1 + 1.438:C2 = C2 + 1.438
1121 IF C1 < C2 THEN C2 = C2 + 1.250: GOTO 1130
1122 IF C2 < C1 THEN C1 = C1 + 1.312: GOTO 1130
1123 GOTO 1130
1124 O1 = O1 + 1.750:C1 = C1 + 1.750:C2 = C2 + 1.750
1125 IF O2 = C1 THEN C1 = C1 + 2.312: GOTO 1130
1126 IF O1 > C2 THEN C1 = C1 + 1.625:O1 = O1 + .938: GOTO 1130
1127 C1 = C1 + 1.438:C2 = C2 + 1.438
1128 IF C2 < C1 THEN C1 = C1 + 1.250: GOTO 1130
1129 IF C1 < C2 THEN C2 = C2 + 1.312
1130 O1 = O1 / SM:C1 = C1 / SM:O2 = O2 / SM:C2 = C2 / SM
1131 IF (O1 = O2 AND C1 < C2) THEN 1138
1132 IF O1 < O2 THEN 1135
1133 T = O1:O1 = O2:O2 = T
1134 T = C1:C1 = C2:C2 = T
1135 IF (C1 > C2 AND ERR = 0) THEN ERR = 9
1138 IF DB = 0 THEN RETURN
1139 HOME : IF ERR = 0 GOTO 1140: PRINT : PRINT : PRINT "ERR = ",ERR
1140 PRINT "ONE OPEN = ";0,O1M%,O2L%
1145 PRINT "ONE CLOS = ";C1E%,C2M%,C3L%
1155 PRINT "TWO OPEN = ";0,O3M%,O4L%
1165 PRINT "TWO CLOS = ";C4E%,C5M%,C6L%
1166 PRINT "OPEN 1: "O1
1167 PRINT "CLOSE 1: "C1
1168 PRINT "OPEN 2: "O2
1170 PRINT "CLOSE 2: "C2
1180 S1 = (C1 - O1)
1190 S2 = (C2 - O2)
1200 SL = (O2 - O1)
1210 SR = (C2 - C1)
1220 PRINT "EXPOSURE 1: ";S1
1230 PRINT "EXPOSURE 2: ";S2
1240 PRINT "SPEED 1: ";SL
1250 PRINT "SPEED 2: ";SR
1260 RETURN
2000 REM PRINT RESULTS OF SHUTTER CAPTURE
2005 REM INPUT O1, O2, C1, C2, TIME OF EXPOSURE/CLOSURE IN MS
2010 VTAB 21
2060 E1 = C1 - O1
2061 E2 = C2 - O2
2100 REM CALC AND PRINT MINUTES,SECONDS,MILLISECONDS,USEC SENSOR
1
2110 K = 0:VT% = 23:H% = 7:SC = 60000:EX% = 1:IN = E1: GOSUB 700:E1 = IN
- (S1% * SC)
2120 VT% = 23:H% = 9:SC = 1000:EX% = 2:IN = E1: GOSUB 700:E1 = IN - (S1%
* SC)
2130 VT% = 23:H% = 12:SC = 1:EX% = 3:IN = E1: GOSUB 700:E1 = IN - (S1% *
SC)
2140 K = 1:VT% = 23:H% = 16:SC = .001:EX% = 3:IN = E1: GOSUB 700
2200 REM CALC AND PRINT MINUTES,SECONDS,MILLISECONDS,USEC SENSOR
2
2210 K = 0:VT% = 24:H% = 7:SC = 60000:EX% = 1:IN = E2: GOSUB 700:E2 = IN
- (S1% * SC)
2220 VT% = 24:H% = 9:SC = 1000:EX% = 2:IN = E2: GOSUB 700:E2 = IN - (S1%
* SC)
2230 VT% = 24:H% = 12:SC = 1:EX% = 3:IN = E2: GOSUB 700:E2 = IN - (S1% *
SC)
2240 K = 1:VT% = 24:H% = 16:SC = .001:EX% = 3:IN = E2: GOSUB 700
2500 REM PRINT SHUTTER SPEEDS
2510 E1 = (O2 - O1) * 2
2520 E2 = (C2 - C1) * 2
2530 REM CALC AND PRINT MILLISECONDS,MICROSECONDS SENSOR 1
2540 K = 0:VT% = 23:H% = 21:SC = 1:EX% = 3:IN = E1: GOSUB 700:E1 = IN - (S1%
* SC)
2550 K = 1:VT% = 23:H% = 25:SC = .001:EX% = 3:IN = E1: GOSUB 700
2560 REM CALC AND PRINT MILLISECONDS,MICROSECONDS SENSOR 2
2570 K = 0:VT% = 24:H% = 21:SC = 1:EX% = 3:IN = E2: GOSUB 700:E2 = IN - (S1%
* SC)
2580 K = 1:VT% = 24:H% = 25:SC = .001:EX% = 3:IN = E2: GOSUB 700
2900 REM DETERMINE AND PRINT FRACTION
2901 IF ERR = 0 THEN 2910
2902 VTAB 23: HTAB (1): PRINT "ERR";ERR;" ";
2903 VTAB 24: HTAB (1): PRINT "ERR";ERR;" ";
2904 RETURN
2910 E1 = C1 - O1
2920 E2 = C2 - O2
3000 FOR I = 0 TO 18
3010 IF (((FR(I) - FR(I + 1)) / 2) + FR(I + 1) < E1) THEN
GOTO 3050
3020 NEXT I
3040 REM COMPUTE FRACTION NOW
3050 S1 = ABS (E1 / FR(I))
3060 S1% = INT (S1 * 100 + .5)
3070 VTAB 23
3080 HTAB (1)
3090 PRINT S1%"% ";
3100 FOR I = 0 TO 18
3110 IF (((FR(I) - FR(I + 1)) / 2) + FR(I + 1) < E2) THEN
GOTO 3150
3120 NEXT I
3140 REM COMPUTE FRACTION NOW
3150 S1 = ABS (E2 / FR(I))
3160 S1% = INT (S1 * 100 + .5)
3170 VTAB 24
3180 HTAB (1)
3190 PRINT S1%"% ";
3200 RETURN
5000 POKE - 16368,0:CH% = CH% - 128: REM LOGIC ANALYZER
CONTROLS
5010 IF CH% = 21 THEN GOTO 5100: REM FORWARD ARROW
5020 IF CH% = 8 THEN GOTO 5200: REM BACKWARD ARROW
5030 IF CH% = 9 OR CH% = 78 THEN GOTO 5300: REM TAB OR
N
5040 IF CH% = 25 OR CH% = 80 THEN GOTO 5400: REM BACK TAB
OR P
5050 IF CH% = 81 THEN TEXT : VTAB 1: HTAB 1: PRINT "
HAVE A NICE DAY :-) ": END : REM "Q"
5060 IF CH% = 65 THEN GOTO 5500: REM "A"
5100 REM :FORWARD ARROW INCREASE SELECTED ITEM
5120 IF CS% < > 0 AND CS% < > 1 THEN
GOTO 5140
5130 CA = CA + FR(SS%) / 17: IF CA > 480000 THEN CA = 480000
5140 IF CS% < > 0 AND CS% < > 2 THEN
GOTO 5160
5150 CB = CB + FR(SS%) / 17: IF CB > 480000 THEN CB = 480000
5160 IF CS% = 3 AND SS% > 0 THEN SS% = SS% - 1
5180 IF CS% = 4 THEN DL = DL + FR(SS%): IF DL > 480000 THEN DL =
480000
5185 GOSUB 8000
5190 GOTO 7200
5200 REM :BACKWARD ARROW DECREASE SELECTED ITEM
5220 IF CS% < > 0 AND CS% < > 1 THEN
GOTO 5240
5230 CA = CA - FR(SS%) / 17: IF CA < 0 THEN CA = 0
5240 IF CS% < > 0 AND CS% < > 2 THEN
GOTO 5260
5250 CB = CB - FR(SS%) / 17: IF CB < 0 THEN CB = 0
5260 IF CS% = 3 AND SS% < 22 THEN SS% = SS% + 1
5280 IF CS% = 4 THEN DL = DL - FR(SS%): IF DL < 0 THEN DL = 0
5285 GOSUB 8000
5290 GOTO 7200
5300 REM :TAB SELECT NEXT ITEM IN LIST
5310 CS% = CS% + 1: IF CS% > 4 THEN CS% = 0
5320 CH% = 0: GOTO 7600
5400 REM :BACK TAB SELECT PREVIOUS ITEM IN LIST
5410 CS% = CS% - 1: IF CS% < 0 THEN CS% = 4
5420 GOTO 7600
5500 IF AU% = 0 THEN AU% = 1: GOTO 5990
5510 IF AU% = 1 THEN AU% = 0
5990 CH% = 0: GOTO 7600
6000 REM PLOT GRAF
6990 RETURN
7000 REM INITIALIZE SCREEN
7020 GOSUB 7600
7110 HTAB (1): VTAB 21
7120 PRINT " EXPOSURE
SHUTTER CRSR"
7130 PRINT "ACRY M SC MS US MS
US"
7140 PRINT " : :
: :"
7150 PRINT " : :
: : DLTA";
7200 REM PRINT SCALE, DELAY AND DELTA
7310 K = 0:VT% = 22:H% = 35:SC = 60000:EX% = 3:IN = FR(SS%): GOSUB 700
7320 IF K = 1 THEN PRINT "MIN";: GOTO 7400
7330 SC = 1000: GOSUB 700
7340 IF K = 1 THEN PRINT "SEC";: GOTO 7400
7350 SC = 1: GOSUB 700
7360 IF K = 1 THEN PRINT "MS ";: GOTO 7400
7370 K = 1:SC = .001: GOSUB 700
7380 PRINT "US ";
7400 REM DELTA
7410 K = 0:VT% = 24:H% = 35:SC = 1000:EX% = 3:IN = ABS (CA -
CB): GOSUB 700
7440 IF K = 1 THEN PRINT "SC";: GOTO 7500
7450 SC = 1: GOSUB 700
7460 IF K = 1 THEN PRINT "MS";: GOTO 7500
7470 K = 1:SC = .001: GOSUB 700
7480 PRINT "US";
7500 REM DISPLAY DELAY
7505 IF AU% = 1 THEN VTAB 23: HTAB 35: PRINT "AUTO ";: RETURN
7510 K = 0:VT% = 23:H% = 35:SC = 60000:EX% = 3:IN = DL: GOSUB 700
7520 IF K = 1 THEN PRINT "MIN";: RETURN
7530 SC = 1000: GOSUB 700
7540 IF K = 1 THEN PRINT "SEC";: RETURN
7550 SC = 1: GOSUB 700
7560 IF K = 1 THEN PRINT "MS ";: RETURN
7570 K = 1:SC = .001: GOSUB 700
7580 PRINT "US ";
7590 RETURN
7600 REM :DISPLAY LOGIC ANALYZER CONTROLS
7610 GOSUB 7505
7620 IF CS% = 0 OR CS% = 1 THEN INVERSE
7630 VTAB 21: HTAB 35: PRINT "A";: NORMAL
7640 IF CS% = 0 OR CS% = 2 THEN INVERSE
7650 HTAB 38: PRINT "B";: NORMAL
7660 IF CS% = 3 THEN INVERSE
7670 VTAB 22: HTAB 30: PRINT "SCAL";: NORMAL
7680 IF CS% = 4 THEN INVERSE
7690 VTAB 23: HTAB 30: PRINT "DLAY";: NORMAL
7990 RETURN
8000 HGR
8002 HCOLOR= 2: HPLOT 0,0 TO 0,159: HPLOT 0,159 TO 278,159: HPLOT 278,159
TO 278,0: HPLOT 278,0 TO 0,0
8010 HPLOT 70,0 TO 70,159: HPLOT 140,0 TO 140,159: HPLOT 210,0 TO 210,159
8050 REM CALCULATE CRITICAL POINTS
8055 HCOLOR= 3
8060 I = - DL / FR(SS%) * 70 + 70
8066 IF I < 1 THEN I = 1
8067 IF I > 279 THEN I = 279
8066 FT%=INT (I / 2) * 2
8070 I = (C1 - DL) / FR(SS%) * 70 + 70
8080 IF I < 1 THEN I = 1
8085 IF I > 279 THEN I = 279
8086 ST%=INT (I / 2) * 2
8090 HPLOT 0,60 TO FT%,60: HPLOT FT%,60 TO FT%,30: HPLOT FT%,30 TO
ST%,30
8095 HPLOT ST%,30 TO ST%,60: HPLOT ST%,60 TO 279,60
8160 I = (O2 - DL) / FR(SS%) * 70 + 70
8166 IF I < 1 THEN I = 1
8167 IF I > 279 THEN I = 279
8168 FT%=INT (I / 2) * 2
8170 I = (C2 - DL) / FR(SS%) * 70 + 70
8180 IF I < 1 THEN I = 1
8185 IF I > 279 THEN I = 279
8186 ST%=INT (I / 2) * 2
8190 HPLOT 0,140 TO FT%,140: HPLOT FT%,140 TO FT%,110: HPLOT FT%,110
TO ST%,110
8195 HPLOT ST%,110 TO ST%,140: HPLOT ST%,140 TO 279,140
8260 I = CA - DL / FR(SS%) * 70 + 70
8266 IF I < 1 THEN I = 1
8267 IF I > 278 THEN I = 279
8268 FT%=INT (I / 2) * 2
8270 I = (CB - DL) / FR(SS%) * 70 + 70
8280 IF I < 1 THEN I = 1
8285 IF I > 278 THEN I = 279
8286 ST%=INT (I / 2) * 2
8290 COLOR= 1: HPLOT FT%,0 TO FT%,159: HPLOT ST%,0 TO ST%,159
8990 RETURN
10000 HOME : REM INITIAL GLOBAL VARIABLES
10010 DIM FR(23): REM VALID SHUTTER SPEEDS
10020 SM = 64: REM CLOCK FREQ IN SAMPLE PER MILLISECOND: 64 FOR REAL:29.257
FOR SIMULATOR
10025 LG = LOG (10): REM LOG(10)
10030 VS% = 250:V1%=235:V2%=206: REM OFFSET FOR VARIABLES
10035 DB = 0: REM DEBUG FLAG 0 = NO DEBUG
10040 FOR I = 0 TO 22: REM NORMAL SHUTTER SPEEDS
10050 READ FR(I)
10060 NEXT
10070 DL = 0: REM INITIAL SCOPE DELAY IN MILLISECONDS(FLOAT)
10075 AU% = 0: REM AUTO DELAY AND SCALE
10080 SS% = 13: REM INITIAL SCOPE SCALE IN MILLISECONDS
10090 CA = 0: REM INITIAL CURSOR A OFFSET IN MILLISECONDS (FLOAT)
10100 CB = 0: REM INITIAL CURSOR B OFFSET IN MILLISECONDS (FLOAT)
10110 CS% = 0: REM SELECTED CONTROL 0=BOTH CURSOR, 1=CURSOR A, 2=CURSOR
B,3=SCALE,4=DELAY
10120 CH% = 0: REM INPUT CHARACTER
10125 GOSUB 8000
10130 GOSUB 7000: REM INITIAL SCREEN
10980 RETURN
10990 DATA 480000,240000,120000,60000,30000,15000,8000,4000,2000,1000,500,250,125,66,33,16
10995 DATA 8,4,2,1,.1,.01,.001
]