Trailing-Edge
-
PDP-10 Archives
-
BB-P363B-SM_1985
-
mcb/loaders/dtedmp.mac
There are no other files named dtedmp.mac in the archive.
.ENABLE LC
.TITLE DTEDMP -- DTE20 SECONDARY DUMP BOOTSRAP
.SBTTL Title page
.IDENT "X05.01"
;
;
; 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.
;
.SBTTL Edit history
;
; Module: DTEDMP
;
; Date: 9-Jun-78
;
; Author: LEE WEBBER
;
; Modifications:
;
; 4.01 24-Oct-78 Lee Webber
;
; Take out DTE reset at start of MOP.
; Set I-bit on reading MOP message.
; Do all dump writes from buffer in low core.
;
; 4.02 26-Oct-78 Lee Webber
;
; Typo fixes.
; Fix "DTESNA" bug.
;
; 4.03 27-Oct-78 Lee Webber
;
; Add MOP header to dump data.
;
; 4.04 31-Oct-78 Lee webber
;
; Add "MOP MODE RUNNING" with core size.
;
; 4.05 19-Dec-78 Lee Webber
;
; Make 128K core size into 124K.
;
; ****** Release V3.0 DECnet-20 ******
;
; 5.01 3-Jun-81 Steve Jenness
;
; Remove some unneeded conditionals.
; Leave bootstrap in low memory; stop overwritting
; high memory.
; Extensive format changes to improve readability.
; Fix NXM trap (4) to prevent screwy occurances
; when a bug occurs after memory search is done.
; Limit DTE MOP "DUMP DATA" message to 2k bytes
; to prevent overrunning end of the buffer
; area onto undumped memory.
.SBTTL Feature test definitions
;** D$$BUG= 0 ; Debug version if defined
M$$XSZ= 512. ; Max size of program is 512. bytes
M$$MSG= 2048. ; Maximum number of bytes per dump request
.SBTTL Macros
;
; Macro - CALL
;
; Function - Subroutine linkage
;
; Usage -
;
; CALL rtnadr
;
; Parameters -
;
; rtnadr address expression for subroutine to be called
;
.MACRO CALL,A
JSR PC,A ;CALL A
.ENDM
;
; Macro - RETURN
;
; Function - To return from a subroutine called with either
; a JSR instruction or the CALL macro.
;
; Parameters - none
;
.MACRO RETURN
RTS PC
.ENDM
;
; Macro - DEBUG
;
; Function - This macro conditionally assembles code. If the feature
; test switch D$$BUG is defined, the specified operation (OP)
; is assembled. If D$$BUG is not defined, the altenate operation
; (ALTOP) is assembled.
;
; Parameters -
;
; OP Instruction to execute if debugging is enabled
; MSG Text to be associated with debugging code
; ALTOP Instruction to execute if debugging is disabled
.MACRO DEBUG,OP,MSG,ALTOP
.IF DF D$$BUG
OP ;MSG
.IF NDF PASS2
.PRINT . ;MSG
.ENDC
.IFF
ALTOP
.ENDC
.ENDM DEBUG
;
; Macro - ERR
;
; Function - This macro generates error conditional code. If the
; debugging feature test switch D$$BUG is defined then a
; conditional instruction is built to check if an error has
; occured. If debugging is enabled and the test succeeds
; the processor is halted. If debugging is disabled and the
; test succeeds, the program jumps to MOPERR to restart the
; MOP protocol processor.
;
; Parameters -
;
; CND Branch type postfix code indicating failure test
; MSG Text to be associated with the failure
; WHERE Optional failure destination if MOPERR is undesirable
;
.MACRO ERR,CND,MSG,WHERE,?LABEL
.IF DF D$$BUG
.IIF IDN <CND>,<R>,
.IIF IDN <CND>,<NE>,BEQ LABEL
.IIF IDN <CND>,<EQ>,BNE LABEL
.IIF IDN <CND>,<PL>,BMI LABEL
.IIF IDN <CND>,<MI>,BPL LABEL
.IIF IDN <CND>,<VC>,BVS LABEL
.IIF IDN <CND>,<VS>,BVC LABEL
.IIF IDN <CND>,<CC>,BCS LABEL
.IIF IDN <CND>,<CS>,BCC LABEL
.IIF IDN <CND>,<GE>,BLT LABEL
.IIF IDN <CND>,<LT>,BGE LABEL
.IIF IDN <CND>,<GT>,BLE LABEL
.IIF IDN <CND>,<LE>,BGT LABEL
.IIF IDN <CND>,<HI>,BLOS LABEL
.IIF IDN <CND>,<LOS>,BHI LABEL
.IIF IDN <CND>,<HIS>,BLO LABEL
.IIF IDN <CND>,<LO>,BHIS LABEL
.IFTF
DEBUG HALT,<ERROR: "MSG">,<B'CND WHERE'MOPERR>
.IFT
LABEL:
.ENDC
.ENDM ERR
.SBTTL General bit definitions
BIT0= 000001
BIT1= 000002
BIT2= 000004
BIT3= 000010
BIT4= 000020
BIT5= 000040
BIT6= 000100
BIT7= 000200
BIT8= 000400
BIT9= 001000
BIT10= 002000
BIT11= 004000
BIT12= 010000
BIT13= 020000
BIT14= 040000
BIT15= 100000
.SBTTL MOP protocol definitions
M.PMLT= 0. ; "Memory load with transfer"
M.PMLD= 2. ; "Memory load"
M.PRMD= 4. ; "Request memory dump"
M.PEMM= 6. ; "Enter MOP mode"
M.PRPR= 8. ; "Request program"
M.PRML= 10. ; "Request/acknowledge memory load"
M.PMMR= 12. ; "MOP mode running"
M.PMDP= 14. ; "Memory dump"
M.PDAP= 16. ; "(REMOTE-11) DAP envelope"
M.PEAM= 18. ; "(REMOTE-11) enter REMOTE-11 ASCII mode"
M.PLDP= 20. ; "Program data"
M.PLBT= 24. ; "Loopback test"
.SBTTL CPU and KT-11 definitions
;
; CPU register definitions
;
SWR= 177570 ; Switch register
PS= 177776 ; Processor status word
PR7= 7*BIT5 ; Priority 7
;
; Memory management register definitions
;
SR0= 177572 ; Status register 0
KISDR0= 172300 ; Kernal page desriptor 0
KISDR1= 172302 ; . . 1
KISDR2= 172304 ; . . 2
KISDR3= 172306 ; . . 3
KISDR4= 172310 ; . . 4
KISDR5= 172312 ; . . 5
KISDR6= 172314 ; . . 6
KISDR7= 172316 ; . . 7
KISAR0= 172340 ; Kernal page address register 0
KISAR1= 172342 ; . . 1
KISAR2= 172344 ; . . 2
KISAR3= 172346 ; . . 3
KISAR4= 172350 ; . . 4
KISAR5= 172352 ; . . 5
KISAR6= 172354 ; . . 6
KISAR7= 172356 ; . . 7
.SBTTL DTE20 definitions
DLYCNT= 0 ; Delay counter
BUSA17= BIT15 ; UNIBUS address bit 17
BUSA16= BIT14 ; UNIBUS address bit 16
DLYMSK= 37777 ; Delay counter
DEXWD3= 2 ; Deposit/examine word 3
DEXWD2= 4 ; . . 2
DEXWD1= 6 ; . . 1
TENAD1= 10 ; KL-10 memory address 1
TENAD2= 12 ; . . 2
TO10BC= 14 ; To -10 byte (word) count
TO11BC= 16 ; To -11 byte (word) count
TO11IB= BIT15 ; Interrupt both -10 and -11 when done
TO11BM= BIT13 ; To -11 byte mode
TO11CM= 7777 ; Byte (word) count
TO10AD= 20 ; To -10 address
TO11AD= 22 ; To -11 address
TO10DT= 24 ; To -10 data word
TO11DT= 26 ; To -11 data word
DIAG1= 30 ; Diagnostic/control register 1
DIAG2= 32 ; Diagnostic register 2
DRESET= BIT6 ; (W) DTE20 reset
CSTAT= 34 ; Control/status register
TO10DN= BIT15 ; (R) to -10 transfer done
DON10C= BIT14 ; (W) clear to -10 done
TO10ER= BIT13 ; (R) to -10 transfer error
ERR10C= BIT12 ; (W) clear to -10 transfer error
TO11DB= BIT11 ; (R/W) to -11 doorbell
INT11C= BIT10 ; (W) clear to -11 doorbell
TO10DB= BIT8 ; (R/W) to -10 doorbell
TO11DN= BIT7 ; (R) to -11 transfer done
DON11C= BIT6 ; (W) clear to -11 done
TO11ER= BIT1 ; (R) to -11 transfer error
ERR11C= BIT0 ; (W) clear to -11 transfer error
DIAG3= 36 ; diagnostic/control register 3
TO10BM= BIT0 ; (W) to -10 byte mode
.SBTTL Find top of physical memory
;
; The BM873-YF, -YG, -YH, -YJ ROM loads this 256. word (512. byte) program
; starting at location 0, then transfers to location 0.
;
; The following registers are left by the ROM:
;
; R1 Address of DTE20 status word "CSTAT"
;
;
;
; Usages that stay constant throughout the program:
;
; Registers:
;
; R1 Virtual address of DTE20 "CSTAT" register
; SP Stack pointer
;
; Page registers:
;
; 0 Maps to physical 0 (and this code)
; 1 Maps to source data (for searching or copying)
; 7 Maps to external page
;
DTEDMP:
DEBUG HALT,<Start of bootstrap>,NOP ; (0) Mark start of bootstrap
BR 10$ ; (2) Skip over timeout code
.WORD 30$,PR7 ; (4,6) Where to go on NXM
;
; Wait for to -11 DOORBELL if not cleared by ROM
;
10$: BIT #TO11DN,(R1) ; To -11 done?
BEQ 15$ ; No.. doorbell has been cleared
BIT #TO11DB,(R1) ; Doorbell ringing?
BEQ 10$ ; No.. wait
;
; Find top block of physical memory (top down search)
;
15$: CLRB MEMMGR ; Indicate unmapped system is running
MOV #STACK-4,SP ; Set stack
MOV #160000,R5 ; Start at external page if no KT11
MOV #77406,R2 ; Set max size for an APR
MOV R2,@#KISDR0 ; Set map for this code (No KT11.. trap to 30$)
MOV R2,@#KISDR1 ; Set map for finding memory
MOV R2,@#KISDR7 ; Set map external page
CLR @#KISAR0 ; Set map segment 0 to this code
MOV #7600,@#KISAR1 ; Start memory search at external page
MOV #7600,@#KISAR7 ; Also map external page
MOV #1,@#SR0 ; Enable segmentation (Turn KT11 on)
MOV #20000,R5 ; Point to where mapping register 1 maps
MOV #20$,@#4 ; Set NXM timeout on KT11 to step down
; through memory.
20$: CMP (SP)+,(SP)+ ; Remove trap stuff put onto stack
DEC @#KISAR1 ; Count down
TST (R5) ; Trap back to 20$ if non-existant memory
;
; Found top of physical memory. Compute physical address.
;
MOV @#KISAR1,R5 ; Get physical address (right-shifted 6 bits)
CLR R4 ; Start with no extension address
ASHC #6,R4 ; Shift extension bits into R4
; Leave low order bits (0-15) in R5
ADD #100,R5 ; Increment size by one 32 word block
ADC R4 ; If carry .. increment bits 16-17
MOV R4,MMRADR+2 ; Save extension bits
MOV R5,MMRADR ; Save physical memory count (0-15)
INC MEMMGR ; Indicate mapped virtual system is running
BR 40$ ; Go save max address and start processing
;
; Here if we must find top of memory without memory management
;
30$: CMP (SP)+,(SP)+ ; Remove trap stuff put onto stack
DEC R5 ; Down by another word
TST (R5) ; Trap to 30$ if still NXM
CLR MMRADR+2 ; Indicate no extension bits
INC R5 ; Increment to make if 1 relative (not 0)
MOV R5,MMRADR ; Save memory word count
;
; Set NXM trap to restart MOP processor on trap.
;
40$: MOV #MOP,@#4 ; Set trap to start of processor
.SBTTL Dump processor
;
; Send a "MOP MODE RUNNING" message
;
MOP: DEBUG HALT,<Start of MOP processor>
MOV #STACK,SP ; Reset stack pointer
MOV #MMR,R0 ; Point to the "MOP MODE RUNNING" message
CALL DTESNA ; Send it
;
; Read a MOP dump request
;
MOPWAT: BIT #TO11DB,(R1) ; Doorbell ringing?
BEQ MOPWAT ; No.. wait until -10 rings us
MOV #RCVMSG,R0 ; Get address of byte count word
MOV #9.,R2 ; Set byte count for this read
MOV R2,R3 ; and total (global) byte count
CALL DTERCA ; Receive dump request message
;
; Verify count and MOP function
;
CMPB #7,BYTCNT ; 7-byte message?
ERR NE,<Invalid message length>
CMPB #M.PRMD,MOPFNC ; Program dump?
ERR NE,<Invalid MOP function code received>
CMP #M$$MSG,MOPCNT ; Check for too big of a request
BGE 5$ ; No .. let it be
MOV #M$$MSG,MOPCNT ; Override count to maximum allowed
5$: CMP MOPADR+2,MMRADR+2 ; Check if memory address exceeded
BGT 10$ ; Error if too big
BLT 20$ ; If less .. then ok
CMP MOPADR,MMRADR ; Extension is equal .. check 0-15
BLO 20$ ; If less .. then ok
10$: ERR R,<Starting dump address is too big>
;
; Write out the dump record for the request
;
20$: MOV MOPCNT,R0 ; Get byte transfer count
ADD #5,R0 ; Add in header length
MOVB R0,COUNT ; Set count in DTE message
SWAB R0
MOVB R0,COUNT+1
MOV MOPADR,R3 ; Get low order (0-15) address bits
TSTB MEMMGR ; Check for mapped memory system
BEQ 30$ ; No.. use 16 bit address only
MOV MOPADR+2,R2 ; Get extension bits
MOV R3,MEMADR ; Set address in dump data messge
MOV R2,MEMADR+2
ASHC #-6,R2 ; Set mapping register to point
MOV R3,@#KISAR1 ; the data to be dumped
MOV MOPADR,R3 ; Calculate
BIC #^C<77>,R3 ; the data's
ADD #20000,R3 ; virtual address
;
; Move the data into low core buffer
;
30$: MOV #DATA,R2 ; Address the transmission buffer
MOV MOPCNT,R0 ; Get byte count
40$: MOVB (R3)+,(R2)+ ; Move a byte
SOB R0,40$ ; and go back for more
;
; Send the block from the buffer in low core
;
MOV #COUNT,R0 ; Address count field
CALL DTESNA ; and send the block out
JMP MOPWAT ; Go cycle again
;
; Here on error during dump processing.
; Ignore dump request.
;
MOPERR: BR MOP ; Send MOP MODE RUNNING message
.SBTTL DTE subroutines
;
; Routine - DTESND
;
; Function - To send a byte stream message across the DTE20 from
; mapped VIRTUAL address space.
;
; R0 points in virtual space to the data buffer. R4 and
; R5 contain the physical offset for R0's virtual space.
;
; Parameters -
;
; R0 Virtual address of data to send
; R1 Virtual address of DTE20 "CSTAT" register
; R4 Physical base addr of data buffer (Bits 17-16, in bits 15-14)
; R5 Physical base addr of data buffer (Bits 15-0)
;
DTESND: MOV R4,DLYCNT-CSTAT(R1) ; Set memory extension bits
ADD R5,R0 ; Convert to physical
BR DTESN1 ; Go send message
;
; Routine - DTESNA
;
; Function - To send a byte stream message across the DTE20 from
; unmapped PHYSICAL address space.
;
; Parameters -
;
; R0 Low-order (bits 0-15) physical address to send data from
; R1 Virtual address of DTE20 "CSTAT" register
;
DTESNA: BIC #140000,DLYCNT-CSTAT(R1) ; Clear memory extension bits
DTESN1: MOV R0,TO10AD-CSTAT(R1) ; Set address of MOP message
MOV #DON10C!ERR10C,(R1) ; Reset TO10DN and TO10ER
MOV #TO10BM,DIAG3-CSTAT(R1) ; Set to -10 byte mode
MOV #TO10DB!INT11C,(R1) ; Ring -10's doorbell with this message
;
; Wait for to -10 transfer
;
10$: BIT #TO10DN!TO10ER,(R1) ; Done or error?
BEQ 10$ ; Not done or error.. wait
ERR PL,<To -10 transfer error>
RETURN ; Return from DTESND/DTESNA
;
; Routine - DTERCV
;
; Function - To receive a byte stream message across the DTE20 into
; mapped VIRTUAL address space.
;
; R0 points in virtual space to the data buffer. R4 and
; R5 contain the physical offset for R0's virtual space.
;
; Parameters -
;
; R0 Virtual address of data buffer
; R1 Virtual address of DTE20 "CSTAT" register
; R2 Number of bytes of message to be received
; R3 Number of bytes total in the message (global count)
; R4 Physical base addr of data buffer (Bits 17-16, in bits 15-14)
; R5 Physical base addr of data buffer (Bits 15-0)
;
DTERCV: MOV R4,DLYCNT-CSTAT(R1) ; Set extended memory bits
ADD R5,R0 ; Make physical address
BR DTERC1
;
; Routine - DTERCA
;
; Function - To receive a byte stream message across the DTE20 into
; unmapped PHYSICAL address space.
;
; Parameters -
;
; R0 Low-order (bits 0-15) physical address of data buffer
; R1 Virtual address of DTE20 "CSTAT" register
; R2 Number of bytes of message to be received
; R3 Number of bytes total in the message (global count)
;
DTERCA: BIC #140000,DLYCNT-CSTAT(R1) ; Clear memory extension bits
DTERC1: MOV R0,TO11AD-CSTAT(R1) ; Set address
ADD R2,R0 ; Update address
BCC 10$ ; No boundary..
BEQ 10$ ; Exactly a boundary.. ok also
;
; The requested transfer crosses a 32K boundary.
; We must do the transfer in two pieces.
;
MOV R0,-(SP) ; Save residual count above boundary
SUB R0,R2 ; Change count to just below boundary
CLR R0 ; Set final address = 0
CALL 10$ ; Do the first part of the transfer
MOV (SP)+,R2 ; Get residual count
MOV R2,R0 ; That's final address, also
10$: MOV #DON11C!ERR11C,(R1) ; Reset TO11DN and TO11ER
SUB R2,R3 ; Last transfer?
BEQ 20$ ; Yes.. Set TO11IB to indicate "DONE"
; to both processors
ERR LT,<To -11 message to short>
BIS #TO11IB,R2 ; Clear TO11IB (when we negate R2)
20$: NEG R2 ; Negate byte count
BIC #^C<TO11IB!TO11BM!TO11CM>,R2 ; Clear unused bits
ERR EQ,<To -11 zero byte transfer>
MOV R2,TO11BC-CSTAT(R1) ; Start transfer
;
; Wait for to -11 transfer
;
30$: BITB #TO11DN!TO11ER,(R1) ; Done or error?
BEQ 30$ ; Not done or error.. wait
ERR PL,<To -11 transfer error>
TST R0 ; This transfer cross a 32K boundary?
BNE 40$ ; No.. all ok
ADD #BUSA16,DLYCNT-CSTAT(R1) ; Yes.. bump address bits
40$: MOV R3,R2 ; Get remaining count, and tst it
RETURN ; Return from DTERCV/DTERCA
.SBTTL Data area
;
; Stack
;
.EVEN
.BLKW 8.
STACK:
;
; Random data
;
MEMMGR: .BLKB 1 ; Memory manager
; 0 - No KT11
; 1 - KT11 exists and is enabled
;
; "MOP MODE RUNNING" message
;
.EVEN
MMRPAD: .BLKB 1 ; Pad byte
MMR: ; Start of message
.BYTE 8.,0 ; Message length
.BYTE M.PMMR ; (1) : B "MOP MODE RUNNING"
.BYTE 20. ; (1) : B DTE device type
.BYTE 1 ; (1) : B MOP version #
MMRADR: .WORD 0,0 ; (4) : B Memory size (bytes)
.BYTE 2 ; (1) : B MOP features supported; dump only
;
; Received MOP message
;
.EVEN
RCVMG0: .BLKB 1 ; Pad byte/start of second message
RCVMSG: ; Start of first message
BYTCNT: .BLKB 2 ; Byte count
MOPFNC: .BLKB 1 ; (1) : B MOP function
MOPADR: .BLKB 4 ; (4) : B Address of data to be dumped
MOPCNT: .BLKB 2 ; (2) : B Number of bytes to be dumped
;
; Count field and start of output buffer in low core
;
.EVEN
SNDPAD: .BLKB 1 ; Pad byte/start of dump data message
COUNT: .BLKB 2 ; DTE transfer byte count
CODE: .BYTE 14. ; (1) : B "DUMP IMAGE" MOP code
MEMADR: .BLKB 4 ; (4) : B Address field
DATA = . ; Start of buffer
.SBTTL END
.IF NDF PASS2
.IF G <.-M$$XSZ>
.ERROR <.-M$$XSZ> ; Too much stuff
.IFF
.PRINT <M$$XSZ-.> ; Free space left
.ENDC
.ENDC
PASS2:
.END DTEDMP