; TRACKS DAILY ACTIVITY
;**************************************************************************
; TRACK.M68 - TRACKs Daily activities entered by user
;
; by Dave Heyliger - AMUS Staff
;
; [1.1] 01/88 JDL PHI/AM - MODIFIED JOBIDX CALLS TO DETECT MULTI
; AND "TRACK" UNDER THE OWNING JOB'S NAME, CONSISTANTLY.
;
; NOTE: you must ".LNKLIT TRACK" after Phase 2 of the assembly
;
; Purpose: to allow a user to enter in a "command" to log daily activity.
;
; Example: ".TRACK worked on the TRACK program" (from the dot, of course)
; would record the "worked on the TRACK program" in a file called
; {JOBNAM}.TRK located in the account where a JOB called TRACK is
; currently logged (see directions below). The format of a sample
; .TRK file might look like this:
;
; Date Time Activity
; ====================================================================
; 07-15-87 1:00 PM STARTED ON THE TRACK PROGRAM
; 07-15-87 2:15 PM TOOK CALL ABOUT JOBNAM.SBR
; 07-15-87 2:22 PM CONTINUED ON TRACK PROGRAM
; etc, etc, etc....
;
; Directions:
;
; 1) Setup a PSUEDO,NULL JOB on your system:
; a) increment the JOBS line in the test .INI
; b) add JOBALC TRACK ; must be this name
; c) add TRMDEF RECORD,PSEUDO,NULL,500,500,100
; d) later in the file, add
; ATTACH RECORD,TRACK
; KILL TRACK
; FORCE TRACK
; MEMORY 10K
; LOG (wherever you want your TRACK files to be)
; TRACK/I
;
; WAIT TRACK
;
; 2) Now JOB TRACK is up and ready for your every command. They are:
; c) TRACK/D - D isplays your current track file
; d) TRACK/I - I nitializes the TRACK JOB on bootup (above)
; e) TRACK activity... will record the activity entered
;
; 3) Each night (or through your backup file), you may then PRINT
; your *.TRK file(s), RENAME them, or whatever. You should note,
; however, if you leave your *.TRK files alone every day they
; can get extremely large. Try to avoid this (there is no bad
; side effects from this except more disk reads/writes).
;*****************************************************************************
AUTOEXTERN
SEARCH SYS ;get the usuals
SEARCH SYSSYM
SEARCH TRM
;original version by Dave Heyliger
VMAJOR=1 ;create 1.0(100) version number
VMINOR=0
VEDIT=100.
;Define variables (both TRACK and your JOB use these at times...)
.OFINI
.OFDEF COMAND,100. ;100. bytes for command line
.OFDEF ODDB,D.DDB ;DDB for file I/O
.OFSIZ IMPSIZ ;IMPSIZ = 12. bytes total
GETIMP IMPSIZ,A5 ;A5 points to variables
;PROCESS
; This section of code processes the input line of .TRACK:
; TRACK/option
; TRACK activity.....
;
BYP ;bypass BS
LIN ;just .TRACK[crlf]?
JNE 10$ ;nope, looks good so far
5$: LEA A0,USAGE ;point to usage message
CRLF ;type out crlf
TTYL @A0 ;type out usage message
EXIT ;and quit
;Input given, find out what kind and process.
10$: CMPB @A2,#'/ ;option entered?
JNE ACTIVE ;nope, must be an activity
CMPB 1(A2),#'I ;initialize?
JEQ TRACK ;yup, wait for others to send info...
CMPB 1(A2),#'D ;display?
JEQ DISPLY ;yup, display the file to the screen
MOV #7,D1 ;else there is an error of sorts..
TTY ;BEEP!
CRLF ;provide CRLF
JMP 5$ ;and tell em how to use it
USAGE: ASCII /Usage: TRACK/
BYTE '/
ASCII /option or TRACK activity/
BYTE 15,12
ASCII / options: /
BYTE '/
ASCII /D - Displays current track file to screen/
BYTE 15,12,11,11,'/
ASCII /I - Initializes TRACK JOB on bootup/
BYTE 15,12,15,12,0
;ACTIVITY
; Here, a user has entered in ".TRACK activity....". This section of
; code will force the following input to a JOB called TRACK:
; JOBNAM_activity......
; This will cause the TRACK JOB to process the activity. Once the input
; line has been received by TRACK, the user is returned to the dot.
;
;*********************************************************************
; [1.1] THIS CODE MODIFIED BY JDL - PHI/AM TO DETECT MULTI OPERATION
; AND RETURN THE OWNER JOB NAME INSTEAD OF THE JOB NAME IF
; OPERATING UNDER MULTI
ACTIVE: PUSH A2 ;save "activity..." pointer [1.1]
JOBIDX ;index jcb [1.1]
MOV JOBATT(A6),D6 ;get attached job index [1.1]
BEQ 5$ ; no attached jot [1.1]
MOV D6,A6 ; get owner job address [1.1]
5$: LEA A1,JOBNAM(A6) ; A1 points to RAD50 jobname [1.1]
LEA A2,COMAND(A5) ;A2 points to command line
UNPACK ;create JOBNAME (6 chars, " " padding)
UNPACK
MOVB #40,(A2)+ ;end with a space
POP A0 ;A0 points to "activity...."
10$: CMPB @A0,#12 ;at end of line?
BEQ 20$ ;yup
MOVB (A0)+,(A2)+ ;nope, move in the ASCII stuff
BR 10$ ;and go again
20$: MOVB #12,@A2 ;end with line feed
LEA A1,RADNAM ;A1 points to RAD50 "TRACK_"
MOV JOBTBL,A0 ;A0 points to JOBTBL
30$: MOV (A0)+,A4 ;A4 points to a JCB
MOV A4,D4 ;set status register
BMI 40$ ;end of table
BEQ 30$ ;"0", so try again
CMM JOBNAM(A4),@A1 ;find "TRACK_"?
BEQ 50$ ;yup, happy days! (A4 pointer to JCB)
BR 30$ ;nope, look some more
40$: TYPECR? <?Could not find a JOB named TRACK on this system.>
EXIT
50$: LEA A2,COMAND(A5) ;and A2 points to "JOBNAM_activity.."
MOV JOBTRM(A4),A5 ;setup for TRMICP
JLOCK ;make sure no 2 people are TRMICPing
60$: MOVB (A2)+,D1 ;get a character
TRMICP ;"FORCE TRACK character"
CMPB D1,#15 ;all done?
BNE 60$ ;nope
JUNLOK ;free the CPU for others
EXIT ;and return to dot!
RADNAM: RAD50 /TRACK /
EVEN
;INITIALIZE
; This section of code is usually run only by the TRACK JOB defined to your
; system. The sole purpose of this section is to wait for input (via TRMICP)
; and process the input accordingly. The input is in a format of
; JOBNAM_activity......
; The processing involves grabbing the system date, time, plus the activity
; and recording this information in a file called JOBNAM.TRK.
;
TRACK: KBD ;wait for input [crlf]
CTRLC EXIT ;quit if killed
LEA A0,ODDB(A5) ;point to DDB workspace
FSPEC @A0,TRK ;fill in DDB
INIT @A0 ;create buffer space
LOOKUP @A0 ;already there?
BEQ 20$ ;yup, open for append
OPENO @A0 ;else open for input (creation)
LEA A4,HEADER ;A4 points to header information
10$: CMPB @A4,#'. ;end of information?
BEQ 30$ ;yes, continue
MOVB (A4)+,D1 ;no, get next byte
FILOTB @A0 ;and write it out
BR 10$
20$: OPENA @A0 ;open for append
30$: MOV #^H0000CC48,D5 ;set flags for date
CLR D3 ;use system time and date
PUSH A2 ;save input command line pointer
LEA A2,ODDB(A5) ;point A2 to DDB
CALL $ODTIM ;write out date and time
POP A2 ;retrieve input command line pointer
BYP ;bypass spaces
40$: MOVB (A2)+,D1 ;get the activity
FILOTB @A0 ;write it out
CMPB D1,#12 ;end of write?
BNE 40$ ;nope
CLOSE @A0 ;yup, close file
JMP TRACK ;wait for next track command line
HEADER: ASCII / Date Time Activity/
BYTE 15,12
ASCII /============================================================================/
BYTE 15,12,'.
EVEN
EXIT: EXIT
;DISPLAY
; Displays the current user's JOBNAM.TRK file to their screen
;
DISPLY: LEA A1,RADNAM ;A1 points to RAD50 "TRACK_"
MOV JOBTBL,A0 ;A0 points to JOBTBL
10$: MOV (A0)+,A4 ;A4 points to a JCB
MOV A4,D4 ;set status register
BMI 20$ ;end of table
BEQ 10$ ;"0", so try again
CMM JOBNAM(A4),@A1 ;find "TRACK_"?
BEQ 30$ ;yup, happy days! (A4 pointer to JCB)
BR 10$ ;nope, look some more
20$: TYPECR? <?Could not find a JOB named TRACK on this system.>
EXIT
;*********************************************************************
; [1.1] THIS CODE MODIFIED BY JDL - PHI/AM TO DETECT MULTI OPERATION
; AND RETURN THE OWNER JOB NAME INSTEAD OF THE JOB NAME IF
; OPERATING UNDER MULTI
30$: JOBIDX ;index jcb [1.1]
MOV JOBATT(A6),D6 ;get attached job index [1.1]
BEQ 35$ ; no attached jot [1.1]
MOV D6,A6 ; get owner job address [1.1]
35$: LEA A1,JOBNAM(A6) ; A1 points to RAD50 jobname [1.1]
LEA A0,ODDB(A5) ;point to output DDB
MOV @A1,D.FIL(A0) ;fill in filename
MOVW #[TRK],D.EXT(A0) ; and extension
MOVW JOBUSR(A4),D.PPN(A0) ; and PPN
MOVW JOBDEV(A4),D.DEV(A0) ; and device
MOVW JOBDRV(A4),D.DRV(A0) ; and drive
INIT @A0 ;initialize the DDB
LOOKUP @A0 ;there?
BEQ 40$ ;yup
TYPECR <?No track file has been created for this JOB.>
EXIT
40$: OPENI @A0 ;open up file for input
50$: FILINB @A0 ;get a byte
TST D.SIZ(A0) ;eof?
BEQ 60$ ;yup
TTY ;nope, type out character
BR 50$ ;and get another character
60$: CLOSE @A0 ;close the file
EXIT