2 REM ***MICRONEYE --VER 2.6 10/13/83***
10 GOTO 2000
15 REM ***THESE REMARKS LEAVE ROOM FOR TEXTPAGE 2 WHICH OVERLAPS APPLESOFT PROGRAM SPACE*****
20 REM *****************************************************************************************************************************************************************************************************************************************
30 REM ***********************************************************************************************************************************************************************
40 REM *****************************************************************************************************************************************************************************************************************************************
50 REM *****************************************************************************************************************************************************************************************************************************************
1000 REM *** MAIN PROGRAM ***
1005 POKE 216,0
1010 GOSUB 5000: REM MAIN MENU
1020 IF S < > 1 GOTO 1500
1030 IF SU GOTO 1065
1040 LET M$ = "CAMERA SETUP UNDEFINED"
1050 GOSUB 6500: REM PRESS RETURN
1060 GOTO 1000: REM RESTART
1065 VTAB 24: HTAB 1: PRINT "(TYPE 'Q' TO RETURN TO MAIN MENU)";
1068 CALL P2
1070 GOSUB 5600: REM CALC PARMS
1080 CALL GE
1100 IF NOT PEEK (772) GOTO 1300
1110 X$ = CHR$ ( PEEK (773) - 128)
1120 IF X$ = "F" OR X$ = "T" THEN D = 0:U(0) = 1:U(1) = 1:U(2) = 1: GOSUB 7970
1130 IF X$ = "<" OR X$ = "," OR X$ = CHR$ (8) THEN ND = 1: GOSUB 7500: GOTO 1290
1140 IF X$ = ">" OR X$ = "." OR X$ = CHR$ (21) THEN ND = 2: GOSUB 7500: GOTO 1290
1145 IF X$ = " " THEN GET X$: GOTO 1290
1150 IF X$ = "C" THEN HGR2 : GOTO 1290
1160 IF X$ = "F" THEN FE = 1: GOTO 1290
1170 IF X$ = "L" THEN GOSUB 4000
1180 IF X$ = "N" THEN PRINT USR (EP + 16384): GOTO 1290
1190 IF X$ = "P" THEN PRINT USR (EP): GOTO 1290
1200 IF X$ = "R" THEN RE = NOT RE: GOSUB 7970: GOTO 1290
1210 IF X$ = "S" THEN GOSUB 4200: GOTO 1290
1220 IF X$ = "T" THEN FE = 0:LL = PEEK (774) + (256 * PEEK (775)):LP = INT (100 * LL / TB)
1230 IF X$ = "Q" GOTO 1000
1240 IF X$ = "A" THEN GOSUB 4500: GOTO 1290
1290 POKE 772,0: REM KEYEXIT=FALSE
1300 WC = PEEK (774) + (256 * PEEK (775))
1315 IF NOT RE GOTO 1350
1317 VTAB 22: HTAB 1
1320 PRINT "EXPOSURE TIME: ";ET;" MSECS "
1330 PRINT "LIGHT LEVEL: "; INT (100 * WC / TB);"% ";: IF NOT FE THEN PRINT "(";LP - MP;"%-";LP + MP;"%) ";
1350 CALL P2: IF FE GOTO 1070
1370 IF WC > (LL + LM) THEN ND = 1: GOSUB 7500: GOTO 1070
1380 IF WC < (LL - LM) THEN ND = 2: GOSUB 7500
1390 GOTO 1070
1500 IF S = 2 THEN GOSUB 3000: GOTO 1000
1510 IF S = 3 THEN GOSUB 7000: GOTO 1000
1520 IF S = 4 THEN GOSUB 4400: GOTO 1000
1530 IF S = 5 THEN GOSUB 6000: GOTO 1000
1540 IF S = 6 THEN GOSUB 5400: GOTO 1000
1545 IF S = 7 THEN GOSUB 7700
1550 IF S = 0 OR S = 8 THEN HOME : END
1560 GOTO 1000
2000 REM *** INITIALIZATION ***
2002 LET D$ = CHR$ (4)
2003 HOME
2006 PRINT D$;"BLOAD CAMASM,A$8000"
2010 PRINT D$;"BLOAD EPRINT,A$8600"
2020 DIM Y$(1),U(2),A$(10),S$(1)
2022 S$(0) = "DIS":S$(1) = "EN"
2025 Y$(0) = "N":Y$(1) = "Y"
2030 LET BE = 65338
2040 LET GE = 32768
2050 LET P2 = GE + 3: CALL P2
2060 LET SA = GE + 6
2070 LET LO = GE + 9
2075 LET FX = GE + 12
2080 LET FT = 1
2090 LET D$ = CHR$ (4)
2100 FOR I = 0 TO 2:U(I) = 4: NEXT
2105 REM *SETUP EPSON CALL
2110 POKE 10,76: POKE 11,3: POKE 12,134
2120 DATA "128 X 64 ","256 X 64 ",256 X 128,512 X 128,1,2,"FIXED ",AUTO-ADJUSTED,"ENABLED ",DISABLED
2130 FOR I = 1 TO 10: READ A$(I): NEXT
2900 GOTO 1000: REM MAIN PROGRAM
3000 REM *** CAMERA SETUP ***
3002 POKE 216,0
3010 HOME : HTAB 13: PRINT "MICRONEYE SETUP"
3020 VTAB 3: PRINT "SELECT LETTER OF DESIRED OPTION..."
3030 HTAB 8: PRINT "(PRESS <RETURN> TO EXIT)": PRINT
3040 PRINT "PICTURE SIZE: A) 128 X 64 C) 256 X 128";
3050 HTAB 15: PRINT "B) 256 X 64 D) 512 X 128"
3060 PRINT "PICTURES/SCREEN: E) 1 PER SCREEN": HTAB 19: PRINT "F) 2 PER SCREEN"
3070 PRINT "EXPOSURE CONTROL: G) FIXED EXPOSURE TIME";
3080 HTAB 19: PRINT "H) AUTO LIGHT ADJUST"
3090 PRINT "STATUS READOUTS: I) ENABLED"
3100 HTAB 19: PRINT "J) DISABLED"
3105 PRINT "LIGHT MARGIN: K)
3110 VTAB 16: HTAB 1: CALL 64578
3120 FOR I = 1 TO 40: PRINT "-";: NEXT
3125 PRINT
3130 PRINT "PICTURE SIZE:";: HTAB 26: PRINT "( PIC/SCREEN)"
3140 PRINT "READOUTS ARE:"
3150 PRINT "EXPOSURE IS:"
3160 PRINT : PRINT "EXPOSURE LEN: MSECS"
3170 PRINT "LIGHT LEVEL: % MARGIN: %"
3172 VTAB 18: HTAB 15: PRINT A$(((2 - SE) * 2) + PW);: HTAB 27: PRINT A$(AR + 4);
3173 VTAB 19: HTAB 15: PRINT A$((1 - RE) + 9)
3174 HTAB 15: PRINT A$((1 - FE) + 7)
3175 VTAB 22: HTAB 15: PRINT ET;
3176 VTAB 23: HTAB 15: PRINT LP;: HTAB 34: PRINT MP;
3180 HTAB 36: VTAB 3: GET X$:X = FRE (0):V = ASC (X$) - 64
3185 IF V < 1 GOTO 1000
3187 GOSUB 5600
3190 ON (V + 1) / 2 GOTO 3220,3230,3240,3250,3260,3301
3210 CALL BE: GOTO 3180
3220 SE = 2:PW = V: GOTO 3280
3230 SE = 1:PW = V - 2: GOTO 3280
3240 AR = V - 4: VTAB 18: HTAB 27: PRINT A$(V);: GOTO 3180
3250 FE = 8 - V: VTAB 20: HTAB 15: PRINT A$(V): ON FE + 1 GOTO 3300,3310
3260 RE = 10 - V: VTAB 19: HTAB 15: PRINT A$(V): GOTO 3180
3280 HTAB 15: VTAB 18: PRINT A$(V);: GOTO 3180
3300 VTAB 23: HTAB 15: INPUT "";LP
3301 VTAB 23: HTAB 19: INPUT "% MARGIN: ";MP
3302 HTAB 38: VTAB 23: PRINT "%";
3308 GOTO 3180
3310 VTAB 22: HTAB 15: INPUT "";ET: IF ET < 0 OR ET > 9999 THEN CALL BE: GOTO 3310
3315 VTAB 22: HTAB 19: PRINT "MSECS";
3320 GOTO 3180
3800 RETURN
4000 REM *** LOADSCREEN ***
4010 VTAB 23: HTAB 1: PRINT "LOAD WHICH PICTURE? ";: CALL P2:F$ = ""
4020 GET X$: PRINT X$;: CALL P2: IF X$ < > CHR$ (13) THEN F$ = F$ + X$: GOTO 4020
4030 IF F$ = "" GOTO 4080
4040 LET M$ = "UNABLE TO LOAD PICTURE"
4050 ONERR GOTO 6500
4055 HTAB 1: VTAB 22: CALL 64668
4057 IF FF = 1 THEN PRINT D$;"BLOAD ";F$;",A$4000": GOTO 4075
4060 PRINT D$;"BLOAD ";F$;",A$6000"
4065 IF PEEK (43616) = 0 AND PEEK (43617) = 32 THEN GOSUB 7900: VTAB 22: PRINT "(GREYSCREEN PICTURE)...";: CALL P2: GOTO 4075
4070 CALL LO: REM LOADSCREEN
4075 VTAB 23: HTAB 1: CALL 64668: PRINT "PRESS ANY KEY TO CONTINUE...";: CALL P2: GET X$
4080 VTAB 23: HTAB 1
4090 PRINT SPC( 40)
4100 RETURN
4200 REM *** SAVESCREEN ***
4210 VTAB 23: HTAB 1: PRINT "SAVE TO WHICH FILE? ";: CALL P2
4215 F$ = ""
4220 GET X$: PRINT X$;: CALL P2: IF X$ < > CHR$ (13) THEN F$ = F$ + X$: GOTO 4220
4225 X = FRE (0)
4230 IF F$ = "" GOTO 4280
4240 LET M$ = "UNABLE TO SAVE PICTURE"
4250 ONERR GOTO 6500
4255 IF FF = 1 THEN PRINT D$;"BSAVE ";F$;",A$4000,L$2000": GOTO 4280
4260 CALL SA: REM SAVESCREEN
4270 PRINT D$;"BSAVE ";F$;",A$6000,L";RC * 20
4280 VTAB 23: HTAB 1
4290 PRINT SPC( 40): CALL P2
4300 RETURN
4400 REM *** SAVE SETUP ***
4410 LET M$ = "CAN'T SAVE SETUP"
4420 ONERR GOTO 6500: REM PRESS RETURN
4430 PRINT D$;"OPEN EYEPARMS"
4440 PRINT D$;"DELETE EYEPARMS"
4450 PRINT D$;"OPEN EYEPARMS"
4460 PRINT D$;"WRITE EYEPARMS"
4470 PRINT ET: PRINT BA: PRINT SL
4471 PRINT AR: PRINT SE: PRINT PW
4472 PRINT LP: PRINT MP: PRINT FE: PRINT RE
4480 PRINT D$;"CLOSE EYEPARMS"
4490 RETURN
4500 A1 = PEEK (GE + 15)
4510 A1 = 1 - A1: POKE GE + 15,A1
4520 VTAB 23: HTAB 1: PRINT "ALARM ";S$(A1);"ABLED, PRESS <RET>...";: CALL P2
4530 GET X$
4540 VTAB 23: HTAB 1: CALL 64668: CALL P2
4550 AL = WC - LM:AH = WC + LM
4555 IF AL < 0 THEN AL = 0
4560 A1 = INT (AL / 256): POKE GE + 17,A1: POKE GE + 16,AL - (A1 * 256)
4570 A1 = INT (AH / 256): POKE GE + 19,A1: POKE GE + 18,AH - (A1 * 256)
4600 RETURN
5000 REM *** MAIN MENU ***
5010 HOME : HTAB 11: PRINT "MICRONEYE DEMONSTRATOR"
5020 VTAB 3: HTAB 4: PRINT "WHAT WOULD YOU LIKE TO DO?"
5030 VTAB 6: HTAB 7: PRINT "(1) START CAMERA"
5040 HTAB 7: PRINT "(2) SETUP CAMERA PARAMETERS"
5050 HTAB 7: PRINT "(3) DISPLAY REAL-TIME COMMANDS"
5060 HTAB 7: PRINT "(4) SAVE CURRENT CAMERA SETUP"
5070 HTAB 7: PRINT "(5) RECALL CAMERA SETUP FROM DISK"
5080 HTAB 7: PRINT "(6) CHANGE MICRONEYE SLOT"
5085 HTAB 7: PRINT "(7) TARGET PRACTICE"
5090 HTAB 7: PRINT "(8) EXIT THIS PROGRAM"
5100 IF FT THEN GOSUB 6000
5110 VTAB 19: HTAB 7: PRINT "SLOT#";SL;" BAUD RATE: ";BA;"00"
5120 VTAB 3: HTAB 31: GET I$:S = VAL (I$)
5130 IF (S < 0) OR (S > 8) THEN CALL BELL: GOTO 5120
5140 RETURN
5400 REM *** SLOT & BAUD ***
5405 VTAB 17: HTAB 1: CALL 64578
5410 ONERR GOTO 5550
5415 VTAB 17: HTAB 4
5420 INPUT "INTERFACE CARD IS IN SLOT#";SL
5430 IF SL < 1 OR SL > 7 THEN CALL BELL: GOTO 5410
5440 POKE 771,16 * SL
5490 BA = 1536
5520 VTAB 17: HTAB 1
5530 FOR I = 1 TO 4: PRINT SPC( 40): NEXT
5540 POKE 216,0: RETURN
5550 CALL BELL: CALL FX: GOTO 5400
5600 REM *** CALC PARMS ***
5610 LET RC = AR * (3 - SE) * 128
5612 RH = INT (RC / 256):RL = RC - (RH * 256)
5614 POKE 777,RL: POKE 778,RH
5630 LET CB = INT (PW * (3 - SE) * 128 / 7) + 1
5640 IF CB = 74 THEN CB = 73
5650 LET CU = CB
5660 IF CU > 40 THEN CU = 40
5670 POKE 776,CB
5680 POKE 780,CU
5690 LET TB = CB * RC / 2
5700 LET ST = 100 * TB / BA
5702 LL = INT (LP * TB / 100):LM = INT (MP * TB / 100)
5705 EP = (256 * CU) + (RC / 2): REM EPSON PARMS
5710 LET CM = 192
5720 IF SE = 1 THEN CM = CM + 32
5730 IF PW = 1 THEN CM = CM + 16
5740 IF AR = 2 THEN CM = CM + 4
5750 LET EX = 1
5760 IF ( NOT FE) OR RE OR ST > ET THEN SK = ET: GOTO 5810
5770 IF ET = 0 THEN SK = 0: GOTO 5790
5780 LET SK = ET - ST
5790 LET EX = 0
5800 LET CM = CM + 2
5810 LET I = INT (SK / 256): POKE 770,I
5820 LET I = SK - (I * 256): POKE 769,I
5825 POKE 768,CM: POKE 779,EX
5860 RETURN
6000 REM *** RECALL SETUP ***
6010 ONERR GOTO 6100
6020 PRINT D$;"OPEN EYEPARMS"
6030 PRINT D$;"READ EYEPARMS"
6040 INPUT ET: INPUT BA: INPUT SL
6041 INPUT AR: INPUT SE: INPUT PW
6042 INPUT LP: INPUT MP: INPUT FE
6043 INPUT RE
6050 PRINT D$;"CLOSE EYEPARMS"
6060 LET SU = 1
6070 POKE 771,16 * SL
6080 LET FT = 0
6090 GOSUB 5600: REM CALCPARMS
6092 POKE 216,0
6095 RETURN
6100 POKE 216,0: CALL FX
6110 IF NOT FT GOTO 6160
6120 GOSUB 5400: REM SLOT&BAUD
6130 LET FE = 1:RE = 0:AR = 1:SE = 2:PW = 2
6140 LET ET = 400:LL = 0:LM = 0
6150 GOTO 6080
6160 LET M$ = "PARM FILE NOT FOUND"
6170 GOSUB 6500: REM PRESSRETURN
6180 GOTO 6080
6500 REM *** PRESS RETURN ***
6510 CALL BELL
6520 LET M$ = M$ + ",PRESS <RET>..."
6530 POKE 216,0
6533 VTAB 23: HTAB 1: PRINT M$;
6534 CALL P2
6535 INPUT "";X$
6540 VTAB 23: HTAB 1: PRINT SPC( 40)
6560 LET I = FRE (0): REM STRING CLEANUP
6565 IF S < > 3 THEN CALL FX
6570 RETURN
7000 REM *** REAL-TIME COMMAND LIST ***
7010 HOME : HTAB 8: PRINT "REAL-TIME COMMAND SUMMARY": PRINT
7020 PRINT " < -- DECREASE EXPOSURE TIME"
7030 PRINT " > -- INCREASE EXPOSURE TIME"
7033 PRINT " A -- TOGGLE ALARM MODE ON/OFF"
7035 PRINT " C -- CLEAR SCREEN"
7040 PRINT " F -- FIX EXPOSURE TIME TO CURRENT"
7050 PRINT " SETTING"
7060 PRINT " L -- LOAD PICTURE FROM DISK"
7070 PRINT " N -- PRINT PICTURE NEGATIVE ON EPSON"
7080 PRINT " P -- DUMP PICTURE TO EPSON"
7090 PRINT " Q -- QUIT AND RETURN TO MAIN MENU"
7100 PRINT " R -- TOGGLE DISPLAY OF READOUTS ON/OFF"
7110 PRINT " S -- SAVE PICTURE TO DISK"
7120 PRINT " T -- USING BLACK/WHITE RATIO OF CURRENT";
7130 PRINT " PICTURE, START AUTOMATIC LIGHT"
7140 PRINT " LEVEL TRACKING"
7142 PRINT
7145 PRINT " SPACEBAR -- FREEZE PICTURE"
7150 LET M$ = "PRESS <RETURN> TO RETURN TO MAIN MENU.."
7160 GOSUB 6530: REM PRESS RETURN ALT ENTRY
7500 REM *** SET SOAKTIME ***
7510 IF ND < > D OR (RD AND U(D) > 2) THEN RD = 1:U(ND) = INT (U(D) / 2): GOTO 7530
7520 RD = 0:U(D) = U(D) * 2
7530 D = ND
7540 IF D = 2 AND (ET + U(2) > 60000) THEN U(2) = 60000 - ET: GOTO 7560
7550 IF D = 1 AND ET < U(1) THEN U(1) = ET
7560 IF D = 2 THEN ET = ET + U(2)
7570 IF D = 1 THEN ET = ET - U(1)
7580 IF U(D) < 1 THEN U(D) = 1
7590 IF ET < 0 THEN ET = 0
7600 IF ET > 60000 THEN ET = 60000
7620 RETURN
7700 REM *** TARGET PRACTICE ***
7710 GOSUB 5600
7720 X1 = FE:FE = 0
7730 X2 = LP:LP = 50
7740 X3 = MP: IF MP < 5 THEN MP = 5
7750 X4 = RE:RE = 1
7760 VTAB 20: CALL 64578
7770 VTAB 24: HTAB 6: PRINT "(TYPE ANY KEY TO EXIT)";
7780 CALL P2
7790 GOSUB 5600
7800 CALL GE
7802 VTAB 23: HTAB 1: CALL 64668: VTAB 22: HTAB 1: CALL 64668
7804 PRINT "EXPOSURE TIME: ";ET
7810 WC = PEEK (774) + (256 * PEEK (775))
7815 PRINT "LIGHT LEVEL: "; INT (WC * 100 / TB);" (";LP - MP;" - ";LP + MP;")": CALL P2
7820 IF WC > (LL + LM) THEN ND = 1: GOSUB 7500
7830 IF WC < (LL - LM) THEN ND = 2: GOSUB 7500
7840 IF NOT PEEK (772) GOTO 7790
7850 FE = X1:LP = X2:MP = X3:RE = X4
7860 POKE 49236,0: POKE 49233,0
7870 RETURN
7900 REM * MOVE $6000-7FFF TO $4000
7910 REM * MONITOR MOVE ROUTINE $FE2C
7920 POKE 60,0: POKE 61,96
7930 POKE 62,255: POKE 63,127
7940 POKE 66,0: POKE 67,64
7950 CALL 65068
7960 RETURN
7970 VTAB 23: HTAB 1: CALL 64668: VTAB 22: CALL 64668: RETURN
8000 REM **********************
8010 REM * VARIABLE DEFINITIONS
8020 REM * AR = ARRAYS USED
8030 REM * BA = BAUD RATE / 100
8040 REM * BE = BELL (CALL -198)
8050 REM * C = CHOICE
8060 REM * CB = COLBYTES (776)
8070 REM * CC = COLCT
8080 REM * CM = COMMAND (768)
8090 REM * CU = COLBYTES USED (780)
8100 REM * D = DIRECTION
8110 REM * ET = EXPOSE TIME
8120 REM * EX = EXIT AT EOF (779)
8130 REM * FE = FIXED EXPOSURE
8140 REM * FT = FIRST TIME
8150 REM * F$ = FILENAME
8160 REM * GE = GETARRAY ADDRESS
8170 REM * HI = HIRESPRT ADDRESS
8180 REM * I = TMP VARIABLE
8190 REM * J = TMP VARIABLE
8200 REM * KX = KEY EXIT (772)
8210 REM * KY = KEY (773)
8220 REM * LL = LIGHT LEVEL
8230 REM * LM = LIGHT MARGIN
8240 REM * LO = LOADSCR ADDRESS
8245 REM * ND = NEW DIRECTION
8250 REM * PT = PREV TOTAL
8260 REM * PW = PIXEL WIDTH
8270 REM * RC = ROWCT (777)
8280 REM * RD = REDUCING
8290 REM * S = SELECTION
8300 REM * SA = SAVESCR ADDRESS
8310 REM * SE = SEND EVERY N PIX
8320 REM * SK = SOAKTIME (769)
8330 REM * SL = SLOT
8340 REM * SLOT*16 (771)
8350 REM * ST = SENDTIME
8360 REM * SU = SETUP
8370 REM * S$ = TEMP STRING
8380 REM * TB = TOTAL BYTES
8390 REM * U = UNITS
8400 REM * WC = WHITECT (774)
8410 REM * Y$ = YES OR NO
8420 REM **********************
8430 REM * 6502 SUBROUTINES
8440 REM * GE (GETARRAY) 32768
8450 REM * HI (HIRESPRT) 32771
8460 REM * SA (SAVESCR) 32774
8470 REM * LO (LOADSCR) 32777
8472 REM * FX (FIXUP) 32780
8474 REM * P2 (TEXTPAG2) 32783
8480 REM * BELL ($FF3A) 65338
8482 REM * CLEOS ($FC42) 64578
8484 REM * CLEOL ($FC9C) 64668
8490 REM ***********************
8500 REM * PEEKS AND POKES
8510 REM * 261 ONERR RESET
8520 REM * VARIABLES USED BY 6502
8530 REM * ROUTINES ARE NOTED
8540 REM * PARENTHETICALLY AFTER
8550 REM * THE VARIABLE DEFINITION
8560 REM **********************
8600 REM *** PROGRAM MODULES ***
8610 REM * MAIN PROGRAM 1000-1999
8620 REM * INITIALIZATION 2000-2499
8630 REM * CAMERA SET-UP 3000-3999
8640 REM * LOADSCREEN 4000-4199
8650 REM * SAVESCREEN 4200-4399
8660 REM * SAVE SET-UP 4400-4599
8670 REM * MAIN MENU 5000-5399
8680 REM * SLOT & BAUD 5400-5599
8690 REM * CALC PARMS 5600-5999
8700 REM * RECALL SET-UP 6000-6499
8710 REM * PRESS RETURN 6500-6999
8720 REM * REALTIME CMDS 7000-7499
8730 REM * SET SOAKTIME 7500-7699
8735 REM *TARGET PRACT 7700-7899
8737 REM * RELOCATE PIC 7900-7999
8740 REM **************************
8900 REM ***RUN 9000 FIXUPS UP THE REMARKS IN LINES 30 TO 50 BEFORE SAVING THE MICRONEYE PROGRAM***
9000 FOR I = 2640 TO 2815: POKE I,42: POKE I + 256,42: NEXT