.title LGTST .ident "V01.0" .enabl lc .nlist me,cnd,bex .sbttl Author's Credits ; Author: Henry R. Tumblin ; Version: 1.0 ; Date: 08-Sep-79 ; For: Systems ; Residence: [311,33]LGTST.MAC ; Build File: LGTST.DCL ; Module Name: LGTST ; Machine/System: PDP-11/70 IAS V3.0 ; Type/Language: Main/Assembler ; Abstract: This subroutine tests all the features of the LG ; pseudo device handler. ; Subroutines Used: ; Edits: ;No. Date By Reason ;--- --------- ------ ---------------------------------------------------- ; none .sbttl mcalls and Local macros .MCALL QIOW$,LGDEF$,DIR$,EXIT$S .MACRO PRINT BUFF,LENGTH,CCW .IF B CCW CLR -(SP) .IFF MOV CCW,-(SP) .ENDC MOV LENGTH,-(SP) MOV BUFF,-(SP) CALL $OUT .ENDM PRINT .MACRO FORMSG FMTSTR MOV #MSGBUF,R0 MOV FMTSTR,R1 MOV SP,R2 CALL $EDMSG PRINT #MSGBUF,R1,#40 .ENDM FORMSG .sbttl DPB's of interest LGDEF$ ; Define LG function codes LGDPB: QIOW$ 0,2,10,100,IOSB,,<0,0,0,0,0,0> ; DPB to comminicate with LG $WRT: QIOW$ IO.WLB,1,1,100,,,<0,0,0> ; DPB for messages IOSB: .WORD 0,0 ; Status block MSGBUF: .BLKB 80. NAMBF: .BLKB 20. ; Name buffer .sbttl Messages MSG00: .ASCIZ "%NStart test of LG...." MSG01: .ASCIZ "%NLogging message to LOG file " MSG02: .ASCIZ "Status = %D" MSG03: .ASCIZ "%NRetrieving my user name" MSG04: .ASCIZ "My user name is %12E, %4R" MSG05: .ASCIZ "%NTesting complete" MSG06: .ASCII "LGTST -- Test message" MSG06S=.-MSG06 MSG07: .ASCIZ "%NAttaching to LG0:" MSG08: .ASCIZ "%NDetaching from LG0:" MSG09: .ASCIZ "%NWaking up handler" .EVEN .sbttl Start MAINLINE START: FORMSG #MSG00 ; Print starting message ; TEST 000 -- Attach to LG0: CALL CLRPRM ; Clear parameter list MOV #LG.ATT,LGDPB+Q.IOFN ; Set function code DIR$ #LGDPB ; Attach to LG: FORMSG #MSG07 ; Print attach message MOV IOSB,-(SP) ; Get status FORMSG #MSG02 ; and include status TST (SP)+ ; Clean stack ; TEST 001 -- Write log file CALL CLRPRM ; Clear parameter list MOV #LG.LOG,LGDPB+Q.IOFN ; Set function code MOV #MSG06,LGDPB+Q.IOPL ; Set buffer pointer MOV #MSG06S,LGDPB+Q.IOPL+2 ; Set buffer length DIR$ #LGDPB ; Perform I/O FORMSG #MSG01 ; Output status message MOV IOSB,-(SP) ; Get status FORMSG #MSG02 ; and include status TST (SP)+ ; Clean stack ; TEST 002 -- Retrieve user name ; Now try to retrieve my user name from IASCOM CALL CLRPRM ; Clear parameter list MOV #LG.NAM,LGDPB+Q.IOFN ; Set function code MOV #NAMBF,LGDPB+Q.IOPL ; Set buffer address DIR$ #LGDPB ; Try to get name FORMSG #MSG03 ; Print starting message MOV NAMBF+22,-(SP) ; Place RAD50 user name on arglst MOV NAMBF+20,-(SP) ; ... MOV NAMBF+16,-(SP) ; ... MOV NAMBF+14,-(SP) ; ... MOV #NAMBF,-(SP) ; Point to ascii username FORMSG #MSG04 ; Output message with username ADD #12,SP ; Clean up the stack MOV IOSB,-(SP) ; Get status FORMSG #MSG02 ; and include status TST (SP)+ ; Clean stack ; TEST 004 -- Wake up handler CALL CLRPRM ; Clear parameter list FORMSG #MSG09 ; Output test message MOV #LG.CHK,LGDPB+Q.IOFN ; Set function code DIR$ #LGDPB ; Issue the directive MOV IOSB,-(SP) ; Get status FORMSG #MSG02 ; and include status TST (SP)+ ; Clean stack ; TEST 005 -- Deattach LG0: CALL CLRPRM ; Clear parameter list MOV #LG.DET,LGDPB+Q.IOFN ; Set function code DIR$ #LGDPB ; Detach FORMSG #MSG08 ; Output message MOV IOSB,-(SP) ; Get status FORMSG #MSG02 ; and include status TST (SP)+ ; Clean stack ; Testing complete, print finish message and leave FORMSG #MSG05 ; All through, leave EXIT$S ; And exit .sbttl Support subroutines BUFF = 2 LENGTH = 4 CCW = 6 $OUT: MOV LENGTH(SP),$WRT+Q.IOPL+2 ; SET LENGTH BEQ 10$ ; EQ - Then skip I/O MOV BUFF(SP),$WRT+Q.IOPL ; Set buffer address MOV CCW(SP),$WRT+Q.IOPL+4 ; set VFC DIR$ #$WRT ; Do I/O 10$: MOV (SP),CCW(SP) ; Reset return address ADD #CCW,SP ; Clean up stack RETURN ; Return to caller CLRPRM: MOV #LGDPB+Q.IOPL,R0 ; Point to paramter list MOV #6,R1 ; Set counter 12$: CLR (R0)+ ; Reset Paramter list SOB R1,12$ ; Loop till thru RETURN ; Return to caller .END START