! * * * * * * * * * * * * * * * !
!				!
!      TECO pre-initializer	!
!      !!TECO.INI V01.00!!	!
!				!
! Last edit on 10-Apr-79 by MHB	!
!				!
! * * * * * * * * * * * * * * * !
!				!
! Private defaulting:		!
!				!
!  VTEDIT mode(s)		!
!	#16 => SEEALL mode	!
!	#32 => HOLD mode	!
[8 @^U8/#16/
!				!
!  LC enable defaulting		!
!	M7"T => Enable LC	!
!	M7"F => Disable LC	!
[7 @^U7/0U7 J :@S%.%"S
::@S%CMD%"U
::@S%CTL%"U
::@S%MAC%"U
::@S%TEC%"U
-1U7 ' ' ' ' ' Q7/
!				!
!  .B2S default switch		!
[6 @^U6%/B2%
!				!
!  .BAS default switch		!
[5 @^U5%/B2%
!				!
!  "ED" defaults		!
[4 @^U4/4#1,0ED/
!				!
! * * * * * * * * * * * * * * * !
!				!
! Functions:			!
!				!
!  1.	Enables lower case	!
!	based upon the user	!
!	supplied M7.		!
!				!
!  2.	If the TECO command is	!
!	present with no args or	!
!	switches, grabs the	!
!	file name from memory,	!
!	if it can.		!
!				!
!  3.	Appends the appropriate	!
!	switch for BASIC-PLUS	!
!	and BASIC-PLUS-2 files	!
!	if no /B? or /n switch	!
!	is already present.	!
!				!
! Switches:			!
!				!
!  /LC	Enables lower case.	!
!				!
!  /NOLC Disables lower case.	!
!				!
!  /NS	Disables auto-loading	!
!	of VTEDIT macro.	!
!				!
!  /NOSCO[P]E]] Same as /NS.	!
!				!
!  /OFF	Disables this macro.	!
!	(As does 'MUNG'.)	!
!				!
!  \	(following '.BAS' or	!
!	'.B2S') Disables the	!
!	automatic setting of	!
!	BASIC-PLUS or		!
!	BASIC-PLUS-2 switches.	!
!				!
! * * * * * * * * * * * * * * * !
!				!
! Q-regs passed:		!
!	0 $ This macro...	!
!	9 $ Memory file spec	!
!				!
! Q-regs used:			!
!	1 % Exit flags:		!
!	    +1 => Load VTEDIT	!
!	    +2 => Inspect only	!
!	    +4 => no use memory	!
!	    +8 => Do /FIND	!
!	   +16 => VTEDIT SEEALL	!
!	   +32 => VTEDIT HOLD	!
!	 +8192 => Write mem	!
!	+16384 => Display file	!
!	+32768 => Memory used	!
!	1 $ Scratch		!
!	2 % ET bits to clear:	!
!	    +4 => No lower case	!
!	2 $ Scratch		!
!	3 % Do announcements	!
!	4 $ VTEDIT default mode	!
!	5 $ .BAS default switch	!
!	6 $ .B2S default switch	!
!	7 % Scratch for M7	!
!	7 $ LC defaulting	!
!	8 $ "ED" default	!
!				!
! * * * * * * * * * * * * * * * !
! Save returned argument Q-reg	!
[1 0,0X1 0U1
! /OFF => Exit immediately	!
J :@FS%/OFF%%"S @O!EXIT! '
! Save Q-regs, set decimal	!
[2 0,0X2 10U2 [2 ^D EDU2 [2 0ED ^XU2 [2 0^X [3
! Do announcements if we can...	!
0U3 ET&512"N J ::@S%MU%"U -1U3 ' '
Q3"T J 2:W< @I%
% >
J 8L 1:W/2-8< @I% % > @I%TECO Version % EO\ J -1W
J 5L 1:W/2-8< @I% % > @I%... working ...% -1W
! Find the time of day		!
-1EJ-4"E 1440-^HU1 | ^H/30U1 '
Q1/60U2 Q2*40+Q1U1
! Is this user crazy?		!
J 12L
Q1-0030"L @I%Are you crazy?% L @I%It's after midnight.% @O!MSG! '
Q1-0400"L @O!NOMSG! '
Q1-0430"L @I%Esta muy loco?% L @I%You should be in bed.% @O!MSG! '
Q1-0830"L @O!NOMSG! '
Q1-0900"L @I%The early bird% L @I%only gets worms.% @O!MSG! '
Q1-1150"L @O!NOMSG! '
Q1-1230"L @I%Go away.% L @I%It's time for lunch.% @O!MSG! '
Q1-2000"L @O!NOMSG! '
Q1-2030"L @I%Ding-a-ling-a-ling...% ETU2 0,1ET 7^T 7^T Q2ET -2W
 L @I%This terminal is alarmed!% @O!MSG! '
Q1-2130"L @O!NOMSG! '
Q1-2200"L @I%I am very tired.% L @I%Please let me sleep.% @O!MSG! '
Q1-2350"L @O!NOMSG! '
@I%It's almost midnight...%
!MSG! J 6L 2R -1W !NOMSG!
! Set the time of day		!
@^U1% AM% Q1-1200"E @^U1% M% '
Q1-1200"G Q1-1200U1 @^U1% PM% '
Q1-100"L Q1+1200U1 '
J 13L 2R 1:W/2-5+(0^Q)< @I% % >
Q1+10000\ 2R @I%:% 3R -D ::@FS%0% %"S R ' 5C G1
! Find and set the date		!
J 10L 1:W/2-11< @I% % >
^B&31U1 ^B/32&15U2
-1EJ-7"E ^B/32&31U1 ^B/32/32&15U2 '
-1EJ-4"E ^B-((^B/1000)*1000)U1 1U2
Q1-32"L @O!GOTDAY! '
%2^[ -31%1-29"L @O!GOTDAY! '
((^B/1000)+2)&3"E Q1-30"L @O!GOTDAY! | -1%1^[ ' '
%2^[ -28%1-32"L @O!GOTDAY! '
%2^[ -31%1-31"L @O!GOTDAY! '
%2^[ -30%1-32"L @O!GOTDAY! '
%2^[ -31%1-31"L @O!GOTDAY! '
%2^[ -30%1-32"L @O!GOTDAY! '
%2^[ -31%1-32"L @O!GOTDAY! '
%2^[ -31%1-31"L @O!GOTDAY! '
%2^[ -30%1-32"L @O!GOTDAY! '
%2^[ -31%1-31"L @O!GOTDAY! '
%2^[ -30%1^[ !GOTDAY! '
-1%2"E @I%   January % @O!GOTMON! '
-1%2"E @I%  February % @O!GOTMON! '
-1%2"E @I%    March % @O!GOTMON! '
-1%2"E @I%    April % @O!GOTMON! '
-1%2"E @I%     May % @O!GOTMON! '
-1%2"E @I%    June % @O!GOTMON! '
-1%2"E @I%    July % @O!GOTMON! '
-1%2"E @I%   August % @O!GOTMON! '
-1%2"E @I%  September % @O!GOTMON! '
-1%2"E @I%   October % @O!GOTMON! '
-1%2"E @I%  November % @O!GOTMON! '
@I%  December % !GOTMON! Q1\ @I%, %
-1EJ-4"E ^B/1000+1970\ | -1EJ-7"E ^B&31+1972\ | ^B/32/16+1900\ ' '
J 6L 2R -1W '
! Initialize flags:		!
!	No VTEDIT, etc.		!
0U1
!	No LC			!
4U2
! Display command (if any)	!
Q3"T J 2:WL X1 :Q1"N
J @I%Command: % G1 -1W
! Should we check out memory?	!
J 2:WL ::@S%TE%"S < 0A"A C > ' ::@S%^ES%^[
.-Z"E .U3 :@EG%MEM%"S G* | EP EA EF
:@ER%^EQ9%"S A HX1 HK EC G1 0,0X1 '
@ER%% @EW%% ' Q3J -1U3
.-Z"N Q1#32768U1 32@I%%
:@S%/FI%"S Q1#8192U1 '
J 2:WL X1 J D @I%Old c%
L @I%New command: % G1 -1W ' ' ' '
! Take the display stuff away	!
J 2:WX1 2:WK '
! Do LC defaulting		!
M7"T Q2#4-4U2 '
! ET$IAS => Load VTEDIT		!
ET&512"N J ::@S%MU%"U Q1#1U1 ' '
! No LC => No LC		!
ET&4"E Q2#4U2 '
! Case flags => No LC		!
EU+1"N Q2#4U2 '
! /LC => LC (if possible...)	!
J :@FS%/LC%%"S Q2#4-4U2
ET&4"E Q3"T J G1 J 2L '
 @I/%Lower case not available/ @O!NOLC! '
EU+1"N Q3"T J G1 J 2L '
 @I/%Lower case too dangerous/
!NOLC! Q2#4U2 Q3"F ^YT ^YK 13^T 10^T |
 -1W J 2:WX1 2:WK ' ' '
! /NOLC => No LC		!
J :@FS%/NOLC%%"S Q2#4U2 '
! /NS => No VTEDIT		!
J :@FS%/NS%%"S Q1#1-1U1 '
! /NOSCO[P[E]] => No VTEDIT	!
J :@FS%/NOSCO%%"S Q1#1-1U1 ::@FS%P%%"S ::@FS%E%%^[ ' '
! Do VTEDIT defaulting		!
Q1&1"N Q1M8U1 0:W-6"E Q1#32#16-16U1 ' '
! Say what we have done		!
Q3"T J G1 ET#Q2-Q2-ET"N J 3L
Q2&4"N @I%Dis% | @I%En% ' @I%abling lower case% -1W '
Q1&1"N J 4L @I%Loading VTEDIT macro%
 Q1&16"N @I%, SEEALL% ' Q1&32"N @I%, HOLD%' -1W '
J 2:WX1 2:WK '
! Clear specified bit(s) in ET	!
Q2,0ET
! Init command revision flag	!
0U2
! Set switch for BASIC-PLUS?	!
J !NEXTBAS! :@S%.BAS%"S
 < ::@S%<^ED%; < ::@S%^ED%; > ::@S%>%; 0; >
 ::@S%\%"S -D -1U2 @O!NEXTBAS! '
 ::@S%/B%"U ::@S%/^ED%"U G5 -1U2 Q1"L Q1#8192U1 ' ' ' @O!NEXTBAS! '
! Set switch for BASIC-PLUS-2?	!
J !NEXTB2S! :@S%.B2S%"S
 < ::@S%<^ED%; < ::@S%^ED%; > ::@S%>%; 0; >
 ::@S%\%"S -D -1U2 @O!NEXTB2S! '
 ::@S%/B%"U ::@S%/^ED%"U G6 -1U2 Q1"L Q1#8192U1 ' ' ' @O!NEXTB2S! '
! Set the last display		!
Q3"T J G1
! Set revised command		!
Q2"T J 2:WL X1 J :@S%C%"S 0K @I%Old c% '
J 2L 2R 0K @I%New command: % G1 '
! Do the last display		!
J 6L 2R 0K -1W J 2:WK '
! Restore Q-regs and radix	!
]3 ]2 Q2^X ]2 Q2ED M4 ]2 Q2^R ]2
! Return the returned argument	!
!EXIT! Q1 ]1 ]4 ]5 ]6 ]7 ]8
