Trailing-Edge
-
PDP-10 Archives
-
BB-P363B-SM_1985
-
mcb/loaders/dmcdrv.mac
There are no other files named dmcdrv.mac in the archive.
.TITLE DMC BOOT DRIVER
.IDENT /V01.02/
;
; COPYRIGHT (c) 1980, 1981, 1982
; DIGITAL EQUIPMENT CORPORATION
; Maynard, Massachusetts
;
; This software is furnished under a license and may be used
; and copied only in accordance with the terms of such license
; and with the inclusion of the above copyright notice. This
; software or any other copies thereof may not be provided or
; otherwise made available to any other person. No title to
; and ownership of the software is hereby transferred.
;
; The information in this software is subject to change
; without notice and should not be construed as a commitment
; by DIGITAL EQUIPMENT CORPORATION.
;
; DIGITAL assumes no responsibility for the use or reliability
; of its software on equipment which is not supplied by
; DIGITAL.
;
;
; MODULE DESCRIPTION:
;
; DMC DRIVER FOR BOOT (AND PANIC)
;
;
;
; DISTRIBUTED SYSTEMS SOFTWARE ENGINEERING
;
; IDENT HISTORY:
;
; 1.00 10-FEB-78
; VERSION 2.0 RELEASE
; .01 25-JAN-79 L. WEBBER LW0001
; WHEN CALCULATING PHYSICAL ADDRESSES, DON'T ASSUME
; THEY ARE IN PAGE 6
; .02 30-SEP-81 D. GUNN DG0002
; TEST FOR REAL OR VIRTUAL ADDRESS
;
;
;
; DEFINE THE MOP DEVICE CODE
;
DEVTYP==12.
;
; LOCAL SYMBOL DEFINITIONS
;
KISAR0=172340 ;LW0001
REBOOT==173356 ;**-1
TMR:: .WORD 0 ;TIMER INDICATOR FOR PANIC
;+
; **-INIDRV-DEVICE INITIALIZATION
;
; INPUTS:
;
; R1 = CSR ADDRESS OF DEVICE
;
; 0(SP) = RETURN ADDRESS
; 2(SP) = BUFFER ADDRESS
; 4(SP) = HIGHEST ADDRESS BEFORE BUFFERS AND DEVICE STORAGE
;
; OUTPUTS:
;
; THE DMC USES THE MEMORY PRECEEDING THE DATA BUFFER FOR ITS
; BASE TABLE. THE DEVICE INITIALIZATION ADJUSTS THE ENTRY ON
; THE STACK TO REFLECT THIS.
;-
;
INIDRV::MOV 2(SP),R4 ;VIRTUAL BASE ADDR
SUB #128.,R4 ;LEAVE ENOUGH ROOM FOR THE BASE TABLE
MOV R4,4(SP) ;ADJUST THE HIGHEST LOAD ADDRESS CELL
MOV R4,BASE ;SAVE FOR INTERNAL DEVICE INITIALIZATIONS
CLR TMR
INIT: BIS #40000,(R1) ;MASTER CLEAR DMC
MOV #100000,(R1) ;TURN DMC ON
MOV BASE,R4 ;GET BASE ADDRESS
JSR PC,GTMADR ;GET REAL ADDR
MOVB #43,(R1) ;RQI + BASE
JSR PC,DMCIN ;GIVE TO DMC
MOV #2400,R3 ;SET MOP & HALF DUPLEX
CLR R4 ;FILLER REG
MOVB #41,(R1) ;RQI + CNTLI
;
; SET PARAMETERS TO DMC
; R4=FIRST PARM
; R3=SECOND PARM
;
DMCIN: TSTB (R1) ;RDYI SET ?
BMI INOK ;YES
TSTB 2(R1) ;RDYO SET ?
BPL DMCIN ;NO
JSR PC,DMCOUT ;CHECK COMPLETION
BR DMCIN ;AGAIN
INOK: MOV R4,4(R1) ;TO FIRST HALF DMC PORT
MOV R3,6(R1) ;TO SECOND HALF DMC PORT
BIC #40,(R1) ;CLEAR RQI-GIVE TO DMC
1$: TSTB (R1) ;RDYI CLEAR ?
BMI 1$ ;NOT YET
CLZ ;FORCE AN ERROR RETURN CONDITION
5$: RETURN ;RETURN TO CALLER
5
;+
; **-RCVDRV-RECEIVE A BLOCK FROM THE DEVICE
; **-SNDDRV-TRANSMIT A BLOCK ON THE DEVICE
;
; INPUTS:
;
; R1 = CSR ADDRESS
; R2 = MAXIMUM BLOCK LENGTH TO RECEIVE, OR
; BLOCK LENGTH TO TRANSMIT
;
; 0(SP) = RETURN ADDRESS
; 2(SP) = BUFFER ADDRESS
;
; OUTPUTS:
;
; Z-BIT SET:
; R2 = ACTUAL LENGTH OF BLOCK RECEIVED
; (SP) = BUFFER ADDRESS
;
; Z-BIT CLEAR:
; AN ERROR WAS DETECTED ON THE DEVICE
; THE STACK IS AS DESRIBED ABOVE
;-
;
.ENABL LSB
RCVDRV::MOVB #44,(R1) ;RQI + BA/CC + RCV
BR 10$ ;
SNDDRV::MOVB #40,(R1) ;RQI + BA/CC + XMT
10$: MOV 2(SP),R4 ;GET ADDRESS OF THE BUFFER
JSR PC,GTMADR ;GET REAL ADDR OF BUFFER
BIS R2,R3 ;SET BUFFER SIZE
JSR PC,DMCIN ;GIVE TO DMC
CLR R5
MOV R3,-(SP)
MOV #20.,R3 ;IN CASE WE NEED LOOP
20$: TSTB 2(R1) ;TEST RDYO SET
BMI 21$
TST TMR ;NOT YET, NEED TIMER?
BEQ 20$ ;NO
DEC R5 ;YES
BNE 20$
DEC R3
BNE 20$ ;
BR DMCOT1
;
; CHECK COMPLETION FROM DMC-11
;
;
21$: CLR TMR
DMCOT1: MOV (SP)+,R3
DMCOUT: MOV 6(R1),R2 ;GET LENGTH OR ERROR BITS
BIC #140000,R2 ;CLEAR MEMORY ENTENSION BITS
TST TMR ;TIMER ERROR?
BEQ 22$ ;NO
CLR TMR ;YES, CLEAR IND.
BR INIT
22$: BITB #3,2(R1) ;BA/CC OR CTLO
BEQ 30$ ;IF EQ, BA/CC COMPLETION
BIT #1730,R2 ;IS IT FATAL ERROR ?
BNE INIT ;IF NE, CLEAR AND REINITIALIZE THE DEVICE
30$: CLRB 2(R1) ;CLEAR RDYO (SETS Z-BIT)
RETURN ;RETURN
.DSABL LSB
;
; GET REAL ADDR FROM VIRTUAL ADDR
; VIRTUAL ADDR IN R4
; REAL ADDR IN R4(LOW 16 BITS)
; REAL ADDR IN R3(HIGH 2 BITS) BITS 14 AND 15
; IF STACK ADDR JUST BELOW 4K BOUNDARY THEN REAL MACHINE
; IF STACK ADDR JUST ABOVE 4K BOUNDARY THEN VIRTUAL MACHINE
; THIS WORKS FOR PRESENT BOOT ONLY ***BEWARE***
;
;
GTMADR: BIT #10000,SP ;DG0002 WHERE IS THE STACK
BNE BMREAL ;DG0002 THIS IS A REAL ADDR
MOV R4,R3 ;CALCULATE THE ;LW0001
ASH #-12.,R3 ; PAGE NUMBER ;LW0001
BIC #^C16,R3 ; (TIMES 2 FOR INDEXING) ;LW0001
MOV KISAR0(R3),R3 ;PICK UP THE PROPER BIAS ;LW0001
ASL R4 ;SEPARATE BIAS FROM DISP ;**-3
ASL R4 ;
SWAB R4 ;BIAS TO LOW BYTE
BISB R4,R3 ;COMPUTE PHYS BLOCK ADDR
ROR R3 ;2 BITS OF PHYS ADDR...
ROR R4 ;TO DISP BYTE
ASR R3 ;
ROR R4 ;
CLRB R4 ;GET RID OF GARBAGE
BISB R3,R4 ;PHYS BLOCK TO ADDR
SWAB R4 ;REAL ADDR AGAIN
CLRB R3 ;CLEAR LOW OF REMAINDER
ASR R3 ;MOVE ADDR BITS 16 & 17
ASR R3 ;TO BITS 6 & 7 OF REG
SWAB R3 ;TO BITS 14 & 15 OF REG
RETURN ;BACK TO CALLER WITH ADDR
BMREAL: CLR R3 ;HIGH ADDR BITS ARE ZERO
RETURN ;BACK TO CALLER WITH ADDR
;
; LOCAL DATA STORAGE
;
BASE: .BLKW 1 ;START OF BASE TABLE
;RESERVED AREA MOVED TO SEPARATE
;MODULE GP020278
.END