; ------------------------------------------------------------- ; TRANSPARENT OUTPUT SPOOLER FOR RT-11 V04 .ENABL LC ; This software is the property of the Government of Canada. ; It may be freely used by any person or agency provided that ; such use is not for gain or reward except as authorized ; by her Majesty or her designated representative. ; Support for this program may be obtained from: ; National Defence Headquarters ; Ottawa Ontario Canada ; K1A 0K4 ; Attn: Mr.Greg.L.Adams ; DACS 2-2-4 ; Phone: (613) 993-9624 ; The department reserves the right to withdraw support without ; notice and does not assume responsibility for the correct ; operation of this software. ; ------------------------------------------------------------- .TITLE SPOOLER MAIN PROGRAM / .IDENT /V01.00/ .NLIST BEX ; This program is the main-line executive for the spooler ; package. It provides task scheduling and flow control. ; Author: GA ; Edit History: ; ----- Macros and other definitions -------------------------- .GLOBL SPINIT,SDCESZ,SDCTAB,$CRPND,D.STAT .MCALL .MRKT,.RSUM,.SPND .MACRO TASK NAME ;Define task control table entry. .GLOBL NAME .WORD 0,NAME .ENDM .PAGE ; ------ Task control table -------------------------------------- .PSECT PURE TSKTAB::TASK CK.INTEN ;Task to check for SP INTEN enabled. TASK SDWTDN ;Task taken after output (to device) done. NUMTSK == .-TSKTAB/4 ;Number of tasks to check. EMTBLK: .BLKW 10. TIME: .WORD 0,5. ;Sleep period for interrupt checking. IOTIME: .WORD 0,60. ;Sleep period for fake output done. ; ----- Entry point (and start of FB USR swap area) ---------------- .PSECT SPOOL START:: CALL SPINIT ;Perform initialization. ; ----- Spooler task scheduling ----------------------------------- SCHED: .SPND ;Wait for a completion routine to resume us. ;When here,a task scheduling event will have occured. MOV #NUMTSK,R5 ;R5 = Number of tasks to check. MOV #TSKTAB,R4 ;R4 => Task control table. SCAN: TST (R4) ;Is the task request count zero? BEQ 1$ ;Yes, then go select next task. DEC (R4) ;No, then mark it as being executed once CALL @2(R4) ;and go execute it. BR SCHED ;When done, re-schedule. 1$: ADD #4,R4 ;Move to next entry in task control table. DEC R5 ;Are all tasks checked? BGT SCAN ;No, go check another. BR SCHED ;Yes, then re-schedule. ; ------------------------------------------------------------------- .PAGE ; ----- Completion and control routines ----------------------------- TIMERON::.MRKT #EMTBLK,#TIME,#CR.TIMER,#1 ;Start timer in motion. RETURN ;Return to caller. ; ------------------------------------------------------------------- FAKEIO::.MRKT #EMTBLK,#IOTIME,#CR.FAKE,R1 ;Start timer for fake output. RETURN ;Return to caller. ; ------------------------------------------------------------------- .PSECT PURE CR.TIMER::MOV #CK.INTEN,R0 ;Here on mark time completion. CALL ..CR.. ;Go schedule its associated task. RETURN ;No comment. ; ------------------------------------------------------------------- CR.FAKE::MOV R0,R1 ;Here on fake output done, R0=device no. CR.DVDN::CLR R0 ;Here on device write done so 1$: DEC R1 ;create an index into SDCTAB. BLT 2$ ADD #SDCESZ,R0 ;Move to next entry until found. BR 1$ 2$: ADD #SDCTAB,R0 ;Add the base address of the table. BIS #$CRPND,D.STAT(R0) ;Flag completion processing due. DVDNSCH:MOV #SDWTDN,R0 ;Now go schedule the processing task. CALL ..CR.. RETURN ;Exit this completion routine. ; ------------------------------------------------------------------- ..CR..: MOV #TSKTAB+2,R1 ;R1 => address of TSKTAB task address. 1$: CMP R0,(R1) ;Is this the entry for this task? BEQ 2$ ;Yes, go schedule it to run. ADD #4,R1 ;No, then move to next entry BR 1$ ;and continue searching. 2$: INC -(R1) ;Increment the task request count. .RSUM ;Resume the main-line, it will dispatch. RETURN ;No comment, most will know what I'me up to. .END START