.MCALL .MODULE .MODULE PIDEF,VERSION=26,COMMENT= ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only 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 except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .IIF NDF MMG$T MMG$T=0 .ENABL LC,GBL .SBTTL MACRO definitions ;+ ;System macros ;- .MCALL .DRDEF,.ADDR,.BR,.ASSUME,.INTEN .MCALL .READC,.SDTTM .DRDEF PI,54,SPFUN$!WONLY$!RONLY$!ABTIO$!HNDLR$,0,0,0 ;+ ;.MACRO .CHRDIS CHAR,ENTRY ; ;Create an table entry of special character and dispatch routine entry point ;for that character. ;- .MACRO .CHRDIS CHAR,ENTRY,VALUE .ASSUME LE 254. .IF NB VALUE .BYTE CHAR,/2 .IFF .BYTE ''CHAR,/2 .ENDC .ENDM .CHRDIS .SBTTL RELOCATION FUNCTION .SBTTL . FOR NON-XM SYSTEM ; ; "PIC" code: ; ; As a handler, PI must be PIC code. The Installation code is ; generally PIC code in the traditional sense (relative ; references (MOV FOO,R3) and ".ADDR" macro type constructions ; (MOV #A,R0 becomes MOV PC,R0 / ADD #A-.,R0)). ; ; The rest of PI uses a macro called $REL to provide relocation ; dynamically. First the operation of $REL in the non-XM version: ; ; For FB, $REL generates several relocation lists: ; ; 1) A single list from the $REL references marked PI, PIRK, PIRV, ; PIK and PIV. This list is used to relocate references from ; PI back to itself. It works by building a list of addresses ; to relocate and by placing in the locations to be relocated ; the relocation bias. ; ; 2) A second list from the $REL references marked RMON, RMONK, and ; RMONV. This list is used to relocate references from PI to RMON ; fixed offsets. It works the same as 1) above, using the value ; of the SYSCOM RMON pointer as the base. ; ; +-----------------------+ ; | | ; | | ; | "RMON" | ; | | ; @JRMON: | | ; +-----------------------+ ; ^ ^ ; |RMON |RMONX ; | | ; +-----------------------+ ; | |----+ ; | | |PI ; | |<---+ ; | |----+ ; | "PIDRV" | |PIRK and PIRV ; | |<---+ ; | |----+ ; | | |PIK and PIV ; PIBASE: | |<---+ ; +-----------------------+ ; .SBTTL . FOR XM SYSTEM ; For XM, $REL generates several relocation lists and performs some ; relocation at assembly time: ; ; 1) A single list from the $REL references marked PI. This list ; works the same way as list 1) under FB above. Note ; that only PI marked $REL entries are in this list under XM. ; ; 2) A second list from the $REL references marked RMON. This list ; works the same way as list 2) under FB above. Note that RMON, ; RMONK, and RMONV are separate lists under XM. ; ; 3) All the entries for $REL marked PIK and PIV are statically ; relocated at assembly time since the virtual base address of PIK ; and PIV is fixed at 20000 (the first address in PAR1). There are ; no lists; the locations are modified by .WORDs generated by $REL. ; ; 4) A third list from the $REL references marked RMONK. This list ; works the same as list 2) above except that locations in the ; PIK extended memory region are modified instead of those in the ; root. ; ; 5) A fourth list from the $REL references marked RMONV. This list ; works the same as list 2) above except that locations in the ; PIV extended memory region are modified instead of those in the ; root. ; ; 6) A fifth list from the $REL references marked PIRK. This list ; works the same as list 1) above except that locations in the ; PIK extended memory region are modified instead of those in the ; root. ; ; 7) A sixth list from the $REL references marked PIRV. This list ; works the same as list 1) above except that locations in the ; PIV extended memory region are modified instead of those in the ; root. ; ; +-----------------------+ ; +--------------->| |----+ ; | +------------| | |PIV ; | | +--------| "PIV" |<---+ ; | | | | | ; | | | 20000: | | ; | | | +-----------------------+ ; | | | ; | | | ; | | | ; | | | +-----------------------+ ; | | | | |----+ ; | | | | | |PIK ; | | |RMONV | "PIK" |<---+ ; | | | | |-----------+ ; | | | 20000: | |<---+ | ; | | | +-----------------------+ | | ; | | | | | | ; | | | |RMONK | | ; | | | V | | ; | | | +-----------------------+ | | ; | | | | | | | ; | | | | | | | ; | | +------->| "RMON" | |PIK |PIRK ; | | | | | | ; | | @JRMON: | | | | ; | | +-----------------------+ | | ; | | ^ | | ; | |PIRV |RMON | | ; | | | | | ; | | +-----------------------+ | | ; | +----------->| |----+ | ; | | |<----------+ ; |PIV | "PIDRV" |----+ ; +----------------| | |PI ; PIBASE: | |<---+ ; +-----------------------+ ; ;+ ; $REL ; ; Used to mark words to relocate in the handler ; ; $Rel Loc Value Base ; ; Loc -- location of word to relocate ; Value -- value to relocate it to ; Base -- base relocation on (PI, PIRK, PIRV, PIK, PIV, ; RMON, RMONK, or RMONV) ; .IF NE MMG$T ; PI marks references to root code from root code ; PIRK marks references to root code from PIK extended memory region ; PIRV marks references to root code from PIV extended memory region ; PIK marks references to PIK extended memory region from the root ; PIV marks references to PIV extended memory region from the root ; RMON marks references to RMON from root code ; RMONK marks references to RMON from PIK extended memory region ; RMONV marks references to RMON from PIV extended memory region .IFF ;NE MMG$T ; PI, PIRK, PIRV, PIK, and PIV mark references to handler code ; RMON, RMONK, and RMONV mark references to RMON .ENDC ;NE MMG$T ;- .IF NE MMG$T .MACRO $REL LOC VALUE BASE .....1 = . . = LOC .....2 = . .IF IDN .WORD VALUE-PIBASE . = .....1 .SAVE .PSECT RELL,D,RO .WORD .....2 .RESTORE .IFF; IDN .IF IDN .WORD VALUE . = .....1 .SAVE .PSECT RELRM,D,RO .WORD .....2 .RESTORE .IFF; IDN .IF IDN .WORD VALUE-PIKBAS+P1ADDR . = .....1 .IFF; IDN .IF IDN .WORD VALUE-PIVBAS+P1ADDR . = .....1 .IFF;IDN .IF IDN .WORD VALUE-PIBASE . = .....1 .SAVE .PSECT RELK,D,RO .WORD .....2 .....3 = .....2 $REL .-2 .....3 PIK .RESTORE .IFF;IDN .IF IDN .WORD VALUE-PIBASE . = .....1 .SAVE .PSECT RELV,D,RO .WORD .....2 .....3 = .....2 $REL .-2 .....3 PIV .RESTORE .IFF;IDN .IF IDN .WORD VALUE . = .....1 .SAVE .PSECT RELRK,D,RO .WORD .....2 .....3 = .....2 $REL .-2 .....3 PIK .RESTORE .IFF;IDN .IF IDN .WORD VALUE . = .....1 .SAVE .PSECT RELRV,D,RO .WORD .....2 .....3 = .....2 $REL .-2 .....3 PIV .RESTORE .IFF;IDN .ERROR ; Unknown B A S E "Base"; .ENDC;IDN .ENDC;IDN .ENDC;IDN .ENDC;IDN .ENDC;IDN .ENDC;IDN .ENDC; IDN .ENDC; IDN .ENDM $REL .IFF ;NE MMG$T .MACRO $REL LOC VALUE BASE .....1 = . . = LOC .....2 = . .IF IDN .WORD VALUE-PIBASE . = .....1 .SAVE .PSECT RELL,D,RO .WORD .....2 .RESTORE .IFF; IDN .IF IDN .WORD VALUE . = .....1 .SAVE .PSECT RELRM,D,RO .WORD .....2 .RESTORE .IFF; IDN .IF IDN .WORD VALUE-PIBASE . = .....1 .SAVE .PSECT RELL,D,RO .WORD .....2 .RESTORE .IFF; IDN .IF IDN .WORD VALUE-PIBASE . = .....1 .SAVE .PSECT RELL,D,RO .WORD .....2 .RESTORE .IFF;IDN .IF IDN .WORD VALUE-PIBASE . = .....1 .SAVE .PSECT RELL,D,RO .WORD .....2 .RESTORE .IFF;IDN .IF IDN .WORD VALUE-PIBASE . = .....1 .SAVE .PSECT RELL,D,RO .WORD .....2 .RESTORE .IFF;IDN .IF IDN .WORD VALUE . = .....1 .SAVE .PSECT RELRM,D,RO .WORD .....2 .RESTORE .IFF;IDN .IF IDN .WORD VALUE . = .....1 .SAVE .PSECT RELRM,D,RO .WORD .....2 .RESTORE .IFF;IDN .ERROR ; Unknown B A S E "Base"; .ENDC;IDN .ENDC;IDN .ENDC;IDN .ENDC;IDN .ENDC;IDN .ENDC;IDN .ENDC; IDN .ENDC; IDN .ENDM $REL .ENDC ;NE MMG$T ;+ ; $XMPTR ; ; For FB, generate a word pointer to reside in REGION (PI, PIK, or PIV) that ; points to a word anywhere in PI (PI, PIK, or PIV). At installation time, ; this pointer is relocated to be the actual address of the word that is ; pointed to. A second word, LENGTH, is generated which is the length of ; the data being pointed to by the word pointer. ; ; For XM, generate a two-word pointer to reside in REGION (PI, PIK, or PIV) ; that points to a word in PI, PIK, or PIV. The first word is the PAR1 ; biased address of the word that is pointed to and the second word is the ; PAR1 value. A third word, LENGTH, is generated which is the length of ; the data being pointed to by the two-word pointer. ; ; ADDR is the address to which the pointer is to be generated. ; ; LENGTH is the length of the data area starting at ADDR ; ; REGION is the current region determined by the current PSECT. Valid ; values are PI, PIK, and PIV. ; ; BASE is the relocation base of ADDR. The values to be used depend on ; what region of PI the pointer is stored in (REGION) and what region ; ADDR is in. ; ; Region of pointer region of BASE ; (REGION) ADDR ;------------------------------------------------ ; PI PI PI ; PI PIK PIK ; PI PIV PIV ; PIK PI PIRK ; PIK PIK PIK ; PIK PIV PIV ; PIV PI PIRV ; PIV PIK PIK ; PIV PIV PIV ; ;- PI$C =: 0 PIRK$C =: PI$C PIRV$C =: PI$C .IF NE MMG$T PIK$C =: 1 PIV$C =: 2 .IFF ;NE MMG$T PIK$C =: PI$C PIV$C =: PI$C .ENDC ;NE MMG$T .MACRO $XMPTR ADDR LENGTH REGION BASE .WORD ADDR $REL .-2 ADDR BASE .IF NE MMG$T .....4 = . .WORD 'BASE'$C .SAVE .PSECT $XM'REGION',D,RO .WORD .....4 $REL .-2 .....4 REGION .RESTORE .ENDC .WORD LENGTH .ENDM ;+ ; Push ; ; Place a word on the stack ;- .MACRO PUSH VALUE .IF IDN <#0> CLR -(SP) .IFF; IDN <#0> MOV VALUE,-(SP) .ENDC; IDN <#0> .ENDM PUSH ;+ ; PushB ; ; Place a byte on the stack ;- .MACRO PUSHB VALUE .IF IDN <#0> CLR -(SP) .IFF; IDN <#0> MOVB VALUE,-(SP) .ENDC; IDN <#0> .ENDM PUSHB ;+ ; Pop ; ; Remove a word from the stack ;- .MACRO POP VALUE,SAVE .IF B .IF B TST (SP)+ .IFF; B BIT @SP,(SP)+ .ENDC; B .IFF; B MOV (SP)+,VALUE .ENDC; B .ENDM POP ;+ ; PopB ; ; Remove a byte from the stack ;- .MACRO POPB VALUE,SAVE .IF B .IF B TSTB (SP)+ .IFF; B BITB @SP,(SP)+ .ENDC; B .IFF; B MOVB (SP)+,VALUE .ENDC; B .ENDM POPB .SBTTL EQUATES .SBTTL . HARDWARE REFERENCES BLK =: 1000 ; block size for disks KTGRAN =: 32.*2 ; KT11 granularity (and PLAS too) P1ADDR =: 20000 ; first address in PAR1 .IRPC X <01234567> KISAR'X =: 172340+<2*X> ;Kernel Instruction PAR'X KISDR'X =: 172300+<2*X> ;Kernel Instruction PDR'X .ENDR AP$ACF =: 077406 ;4KW page with no trap/abort MMUSR0 =: 177572 ;Memory management unit SR0 MMUSR3 =: 172516 ;Memory management unit SR3 PROCFG =: 37776 ;PAR1 biased address of ; start of CONFIG table CTI =: -10. ;Offset to number of option slots SLOT0 =: -14. ;Option slot 0 ID KB$STA = 2 ;KB Status register offset from KB data buffer KBTRD$ = 1 ;KB data register transfer done bit CKSEC = 173000 CKMIN = 173004 CKHR = 173010 CKDAY = 173016 CKMON = 173020 CKYR = 173022 CKCSR0 = 173024 CKCSR1 = 173026 CKCSR2 = 173030 CKCSR3 = 173032 CK.HM = 2 CK.DM = 4 PS =: 177776 ; PSW in machines that have them CMKERN =: 140000 ; Current mode kernel PC$CSR = 174000 ; CSR for option slot 0 PC$VEC = 300 ; Vector A for option slot 0 CNTRL0 = 173202 ; Controller 0 data register KBIENB = 31 ; Enable keyboard interrupts KBIRPT = 131 ; Input keyboard interrupt .SBTTL . SYSCOM REFERENCES JSP =: 42 ; original stack pointer value JSW =: 44 ; Job Status Word EDIT$ =: 20 ; Single line editting repressed SPXIT$ =: 40 ; exit w/command w/o breaking @ files TCBIT$ =: 100 ; no wait on input/output bit OVLY$ =: 1000 ; overlaid program VIRT$ =: 2000 ; Virtual program (XM) CHNIF$ =: 4000 ; command in chain area for KMON TTSPC$ =: 10000 ; character input mode RSTRT$ =: 20000 ; Restart allowed TTLC$ =: 40000 ; allow LC input JUSERB =: 53 ; User error byte SUCCS$ =: 1 ; error level bit code WARN$ =: 2 ERROR$ =: 4 SEVER$ =: 10 FATAL$ =: 20 JRMON =: 54 ; pointer to RMON SYSPTR =: 54 ;RMON start address .SBTTL . BLOCK0 REFERENCES H.GEN =: 60 ; sysgen bits byte H.DPTR =: 70 ; pointer to data in handler file INS.CSR =: 176 ; install CSR value INS.DK =: 200 ; install EP for non-system device INS.SY =: 202 ; install EP for system device BITMAP =: 360 ; low address of bit map area .SBTTL . CHAIN AREA REFERENCES CMDLEN =: 510 ; command length word for KMON CMDSTR =: 512 ; command string for KMON .SBTTL . RMON REFERENCES $INTEN =: 0 ; offset to $INTEN routine SYSVER =: 276 ; offset to version byte MINVER =: 5 ; minimum version number supported CONFG1 =: 300 ;RMON fixed offset - Configuration word 1 C1.FX = 1 ;0 -> SJ monitor ;1 -> FB (if C1.XM = 0) ;1 -> XM (if C1.XM = 1) C1.XM = 10000 ;1 -> XM is C1.FX = 1 FREQ = 40 ;0 -> 60 Hertz clock ;1 -> 50 Hertz clock FORK = 402 ;Pointer to FORK processor SPSTAT = 414 ;Spooler status word SP.ON = 200 ;Spooler is running PRTSCR = 10000 ;Tell the spooler to print screen MEMPTR =: 430 ; fixed offset to memory pointers ;@+SPACE ;When initializing a character cell use space ;+ ;Assigned values for character sets. ;- US$SET = 0 ;US ASCII character set LN$SET = 1 ;Line drawing set NR$SET = 2 ;National replacement ASCII character set ;+ ;Screen background pixel pattern. ;- DARK = 0 ;Dark background GREY = 52525;125252 ;Grey background LIGHT = 177777 ;Light background .SBTTL Keyboard Constants ;+ ;Keyboard key codes. ;- KBFRSK = 86. ;First keycode that we use KBLASK = 255. ;Last keycode that we use (one byte) ILL = 200 ;Invalid or reserved character or keycode INV = 377 ;Reserved character ;+ ;Keyboard commands ;- KBELL = 247 ;Bell KARENB = 343 ;Enable autorepeat KARDSB = 341 ;Disable autorepeat KLEDON = 23 ;Turn on LED(s) function KLEDOF = 21 ; " off " " KLED4 = 210 ;LED 4 parameter KLED3 = 204 ;LED 3 parameter KLED2 = 202 ;LED 2 parameter KLED1 = 201 ;LED 1 parameter KLEDHS = KLED4 ;HOLD SCREEN parameter KLEDLO = KLED3 ;CAPS LOCK parameter KLEDCO = KLED2 ;COMPOSE KLEDWA = KLED1 ;WAIT KCLICK = 237 ;Sound keyclick KCLON = 33 ;Turn keyclick on KCLVOL = 202 ;Keyclick volume (this is the PC default) KCLOFF = 231 ;Disable keyclick ;+ ;Definitions for video code. ;- CHRTMP = 10. CBUFSZ = 10. ;Buffer size of temporary character buffer SCRWID = 64. ;Width of screen in words .IF EQ MMG$T ;If FB CELWRD = 80.*CHRLIN ;Number of words in character cell .IFF ;If XM CELWRD = 132.*CHRLIN ;Number of words in character cell .ENDC ;EQ MMG$T PXLLIN = 1024. ;Pixels per scan line PXLWRD = <*CHRTMP> ;Number of pixel words per printable row PAR1BI = 170000 ;Buffer PAR1 bias value PAROFF = 20000 ;PAR1 offset RESET = 0 ;Value of reset SET = 1 ;Value of set ;+ ;Byte values for sequence types. ;- E$SEQ = 1 ;Escape sequence E$CSI = 2 ;Control sequence E$DCS = 3 ;Control string sequence ;+ ;Bit definitions for character attributes (D$ATT). Low 4 bits in byte. ;- BLINK = 200 ;Blink character attribute (same as bold) BOLD = 100 ;Bold character attribute UNDER = 40 ;Underscore character attribute REVRSE = 20 ;Reverse image ;+ ;Bit definitions for line attributes. See LINCEL in VIDEO.MAC. ;- D$DSWL = 0 ;Single width line D$DHLT = 1 ;Double high line - top half D$DHLB = 2 ;Double high line - bottom half D$DWL = 4 ;Double width line ;+ ;Assignments for cursor positioning directions. ;- C$UB = 1 ;Cursor backward C$UU = 2 ;Cursor up C$UF = 4 ;Cursor forward C$UD = 10 ;Cursor down CHRLIN = 24. ;Number of lines on screen MAXPAR = 16. ;Maximum number of escape sequence paramaters MAXMIN = 30. ;Number of minutes for blink SECOND = 60. ;Number of seconds in a minute CYCTIC = 63. ;Ticks per cursor on/off cycle TICSEC = 60. ;Ticks per second ;+ ;To calculate maximum cursor cycles (2*MAXMIN*SECOND*TICSEC/CYCTIC without ;causing overflow. ;- ...NUM = 2*MAXMIN*SECOND ...QUO = ...NUM/CYCTIC ...REM = ...NUM- MAXCYC = ...QUO*TICSEC + <...REM*TICSEC/CYCTIC> ;Maximum cursor cycles ; (number of blinks before ; screen blanks)