Код:
; DEC/CMS REPLACEMENT HISTORY, Element MACRO.MAC
; *10 13-DEC-1990 15:56:27 MACRO11 "Changed version number"
; *9 23-OCT-1989 16:00:18 STEVENS "INCREASE BUFFER FOR AUTO LABEL GENERATION"
; *8 7-OCT-1987 20:02:04 STEVENS "V05.05 VERSION"
; *7 2-SEP-1987 15:43:21 STEVENS "Changed update revision letter"
; *6 2-SEP-1987 14:41:38 STEVENS "CHANGED .ENABL/.DSABL HEX COMMAND TO .LIST/.NLIST HEX"
; *5 29-JUN-1987 20:22:13 STEVENS "Added /EN:BMK for MACRO regression testing"
; *4 18-AUG-1986 11:23:40 WORRALL "Complete HEX listing support for version 5.5 fieldtest"
; *3 19-MAY-1986 17:03:43 WORRALL "Update version string to V05.04 for SDC release"
; *2 14-APR-1986 23:31:53 SYSTEM "Update 5.4 of MACRO-11"
; *1 28-MAR-1986 02:40:01 SYSTEM "Load MACRO-11 sources from V5.3"
; DEC/CMS REPLACEMENT HISTORY, Element MACRO.MAC
.NLIST
.ENABL LC,GBL
.LIST
.TITLE MACRO - MACRO-11 Root code and data
.SBTTL MACRO - MACRO-11 Root code and data
.SBTTL
.SBTTL .IDENT /V05.06/
.SBTTL
.IDENT /V05.06/
;****************************************************************************
;* *
;* COPYRIGHT (c) 1983, 1986 *
;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. *
;* ALL RIGHTS RESERVED. *
;* *
;* 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 THAT IS NOT SUPPLIED BY DIGITAL. *
;* *
;****************************************************************************
;++
; Facility: MACRO-11 The PDP-11 macro assembler for RT/RSX/VMS and RSTS/E
;
; Author: Too many people to list here
;
; Created: From the dust and dirt
;
; Abstract: MACRO-11 assembler root module
;
; Externals Description
; --------- -----------
;
; Edit Who Date Description of modification
; ---- --- ---- ---------------------------
; 001 Jrw 08-Apr-83 Bump to FT version for micro/rsx
; macro-11/vax and IAS ft's.
; Correct exit status handling.
; 002 Jrw 20-Apr-83 Put LINPPG in RW data psect.
; 003 Jrw 04-May-83 Update rev for MACINI bug change.
; 004 Jrw 12-May-83 Update rev for STMNT bug change.
; 005 Jrw 31-May-83 Update rev for SETIMM bug change.
; 006 Jrw 07-Jun-83 Update rev for SECTR bug change.
; 007 Jrw 13-Jun-83 Update rev for OPTERR.RSX bug fix.
; 008 Jrw 17-Jun-83 Update to SDC 5.1 for autopatch release.
; 009 Jrw 03-Jul-83 Update to FT 5.1a for STMNT rebug fix.
; 010 Jrw 15-Jul-84 Update to FT 5.3 for EXPRS bug fix.
; 011 Jrw 30-Aug-84 Update to FT 5.3a for RDWR.RT bug fix.
; 012 Jrw 05-Nov-84 Update to sdc 5.3. INOFL.RT fix.
; 013 Jrw 11-Nov-84 Update for logical name CSI$4 addition.
; 014 Jrw 11-Dec-84 Update to 'V' for release.
; 015 Jrw 24-Jan-85 Add cell SYMEND for STMNT/SYMBL bug fix.
; 016 Jrw 03-Feb-85 Add cells for $GTLIN + $CSIBL
; 017 Jrw 06-Feb-85 Bump to .03a for MACINI workfile fix
; under RT, and $PGLEN fix under RSX.
; 018 Jrw 20-Feb-85 Bump to .03b for MROOT .GTIM fix for
; RT-11 only.
; 019 Jrw 23-Mar-85 Bump to .03c for RSTS/IAS f.flg/fl.aex
; correction for no logical name support.
; 020 Jrw 12-Jun-85 Bump to .03d for P/OS new syslib support
; and VAX-11 RSX .CSI4 support.
; 021 Jrw 26-Nov-85 Update to .04 for RDWR.RT and CNDTL fix.
; 022 Jrw 12-Dec-85 Add /ENABLE:HEX conditionalized.
; 023 Jrw 19-May-86 Update to V.04 w/sectr nosav correction.
; 024 Jrw 18-Aug-86 FT .05 for HEX listing support.
;--
.SBTTL
.SBTTL MCALL's
.IF NDF,RT11
.MCALL CSI$, FDOFF$, FSRSZ$, GCMLB$, FDAT$A, FDBDF$
CSI$
FDOFF$ DEF$L
.ENDC; NDF,RT11
.SBTTL PSECT Definitions
;+
; The PSECTs are defined here to give them the desired ordering. Consider
; the ordering critical. Several of the PSECTs contain stoppers for the
; lists in the preceding PSECT.
;
; Be CAREFULL about assuming you can stopper I&D psects together, as if
; macro is built I&D under RSX-11M PLUS, this will NOT work.
;-
.PSECT , RW, I, LCL, CON ; Blank Psect for low memory area
.PSECT ROODAT RW, D, GBL, CON, SAV
; Global patch locations (edbits,lcbits,linppg)
LINPPG::.WORD 60. ;Lines per page - patched at RUN time by MACINI
EDBITS::.WORD EDINIT ;Defaults for .enabl/.dsabl
LCBITS::.WORD LCINIT ;Defaults for .list/.nlist
.IF DF,RT11 ;If RT-11
PURE LOWPUR,D,GBL ; LOW data PURE psect for RT-11 USR
.PSECT LOWDAT, RW, D, GBL, CON ; LOW data psect for RT-11 USR.
EMAREA::.BLKW 5 ;For .LOOKUP in MLIBS,RDWR and INOFL.
$GTLIN::.BLKB 82. ;.GTLIN buffer for error messages
$CSIBL::.BLKW 39.+<4*4> ;.CSISPC block for file descriptors +
;4 special descriptors at end.
.ENDC; DF,RT11 ;If RT-11
; Define "ROLLS" psect ordering
.PSECT ROLBAS,D,RW
$LSBAS::
ROLBAS::
.PSECT ROLTOP,D,RW
$LSTOP::
ROLTOP::
.PSECT ROLSIZ,D,RW
;;; PURE ROLSIZ,D
$LSSIZ::
ROLSIZ::
.PSECT LSTCNT,D,RW
$LSCNT::
.SBTTL Define impure data sections
.IF DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW,GBL
.IFF; DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW
.ENDC; DF,RT11 ;If RT-11
IMPURE::
.PSECT IMPURT,D,RW
IMPURT::
.PSECT IMPPAS,D,GBL,RW
IMPPAS::
.PSECT IMPPAT,D,GBL,RW
IMPPAT::
.PSECT IMPLIN,D,GBL,RW
IMPLIN::
.PSECT IMPLIT,D,GBL,RW
IMPLIT::
.PSECT MIXED,D,RW ;Mixed initialized data
PURE TXTBYT,D ;Pure ascii text
PURE PUREI,I ;Pure I-CODE section
PUREI:: ;Start of pure code section
.SBTTL Absolute psect definitions
.PSECT ..IO..,RW,D,GBL,ABS,OVR ;I/O Flag definitions
.PSECT ..ED..,RW,D,GBL,ABS,OVR ;Enable/disable definitions
.PSECT ..LC..,RW,D,GBL,ABS,OVR ;List/nlist definitions
.PSECT ..CT..,RW,D,GBL,ABS,OVR ;Character typing flags
.PSECT .OPCL.,RW,D,GBL,ABS,OVR ;Opcode class definitions
.PSECT .ERR., RW,D,GBL,ABS,OVR ;Error bit definitions
.ERR.:
.SBTTL Version identification text
.IF NDF,XEDBMK
.PSECT MIXED,D,RW
.IFF; NDF,XEDBMK
PURE TXTBYT,D
.ENDC; NDF,XEDBMK
HDRTTL::.ASCII /MACRO / ;Our name in lights!
$MVRSN::.ASCII /V05.06/ ;Major version
$MVRUP::.ASCII / / ;Update letter
.ASCIZ / / ;A space and a blank.
.IF NDF,XEDBMK
.EVEN
.ENDC; NDF,XEDBMK
.SBTTL Error bit flags definitions
PURE TXTBYT,D
TMPCNT = 1 ;Setup counter for bit shifting
ERRMNE::.IRPC CHAR,< ABDEILMNOPQRTUZ> ;Generate error codes
.ASCII /CHAR/
ERR.'CHAR==TMPCNT+.ERR.
TMPCNT= TMPCNT+TMPCNT
.ENDR
.SBTTL Virtual memory list definitions - "ROLLS"
; Macro definitions to generate resident data base to access
; virtual memory lists and real memory tables.
.MACRO GENROL NAME,BASE,TOPE,SIZE
.PSECT ROLBAS,D,RW ;Base psect
NAME'ROL==.-ROLBAS
BAS'NAME::.WORD BASE
.PSECT ROLTOP,D,RW ;Top of rolls psect
TOP'NAME::.WORD TOPE
.PSECT ROLSIZ,D,RW
;;; PURE ROLSIZ,D ;Size of rolls psect
SIZ'NAME::.WORD SIZE*2
.ENDM GENROL
.MACRO GENLST NAME,SIZE
.PSECT ROLBAS,D,RW
NAME'LST==.-$LSBAS
BAS'NAME::.WORD 0
.PSECT ROLTOP,D,RW
.WORD 0
.PSECT ROLSIZ,D,RW
;;; PURE ROLSIZ,D
.WORD SIZE*2
.PSECT LSTCNT,D,RW
.WORD 0
.ENDM GENLST
; Do the definitions
.IF NDF,RT11 ;If not RT-11
GENLST LIB, 5 ;Macro library files list
.ENDC; NDF,RT11 ;If not RT-11
GENLST SEC, 5 ;Program section list
ZP$LST==SECLST ;Following 4 lists can be ...
;Zapped -- all are scratch ...
;Lists with 4-word entries
GENLST DMA, 4 ;Dummy argument list
GENLST MCL, 4 ;.MCALL Name list
GENLST COD, 4 ;Code generation list
GENLST CPX, 4 ;Complex expression polish list
VM$LST==CPXLST ;Previous are virtual memory lists
;
; Define real memory tables
;
GENROL CND,CNDBAS,CNDTOP,2 ;Conditional arguments
GENROL EDT,EDTBAS,EDTTOP,2 ;Enabl/dsabl
GENROL LCD,LCTBAS,LCTTOP,1 ;Listing control
GENROL SAT,SATBAS,SATTOP,2 ;.PSECT attributes list
.IF NDF,RT11 ;If not RT-11
GENROL SWT,SWTBAS,SWTTOP,2 ;Command string switches
GENROL CRF,CRFBAS,CRFTOP,2 ;Cref options
.ENDC; NDF,RT11 ;If not RT-11
.SBTTL IMPURE psect data (Cleared on start/restart)
.IF DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW,GBL
.IFF; DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW
.ENDC; DF,RT11 ;If RT-11
.IF DF,W$$EK ;If .WEAK directive
$WEAHD::.BLKW 1 ;Listhead for .WEAK directive support
.ENDC; DF,W$$EK ;If .WEAK directive
PASS:: .BLKW 1 ;Current pass number ?Should be a byte
.IF DF,RT11 ;If RT-11
PASSTB::.BLKB 6 ;Pass switch value save area
LSTREQ::.BLKW 1
LSTDEV::.BLKW 1
CPXSTL::.BLKW 1
OBJPNT::.BLKW 1
RLDPNT::.BLKW 1
$OPCOD::.BLKW 1
;+
; Virtual memory storage
;
; Note that virtual addresses are word addresses, giving a 64k word address
; space. also, released macro and symbol table space is kept in separate
; freelists for reuse. Garbage collection is never done.
;-
$LSNDX::
ROLNDX::.BLKW 1
$LSPNT::
ROLPNT::.BLKW 1
$LSFLG::
ROLUPD::.BLKW 1
ZAPLST::.BLKW 1 ;Free list for released 5 word storage blocks
; ordered last in/first out
SUBLHD::.BLKW 1
SUBNDX::.BLKW 1
$HGVAD::.BLKW 1 ;Next available virtual address
; If a request crosses a page boundry the
; allocation starts at $HGPAG
$CURPG::.BLKW 1 ;Pointer to last referenced page header
$HGPAG::.BLKW 1 ;Next available virtual page boundry
$PAGLS::.BLKW 1 ;Pointer to resident page vector; zero if none
$PAGHD::.BLKW 1 ;Head of resident page linked list
$TIME:: .BLKW 1 ;LRU timer, bumped for each virt mem reference
$WFRDC::.BLKW 1 ;Count of work file reads
$WFWRC::.BLKW 1 ;Count of work file writes
$HSYBS::.BLKW 1 ;Base addr for initial page of hash table
$HPSBS::.BLKW 1 ;Base addr for pst/macro hash table
$HSYLM::.BLKW 1 ;Number of pages in USER hash table*400
$HPSLM::.BLKW 1 ;Number of pages in PST hash table*400
$HSOFL::.BLKW 1 ;Overflow page for USER symbol hash table
$HPOFL::.BLKW 1 ;Overflow page for OPCODES/MACRO names table
; Macro storage
GENBUF::.BLKB 96.
MNCNT:: .BLKW 1
MCLPNT::.BLKW 1
ARGBUF::.BLKB 64.
TMPOFF::.BLKW 1
TMPTXT::.BLKW 1
NULCNT::.BLKW 1 ;?For .NCHR bug
.PSECT MIXED,D,RW
MSBOFF::.BLKW 1 ;Macro text block offset pointer
.PSECT LOWDAT, RW, D, GBL, CON ; LOW data psect for RT-11 USR.
WRKSPC::.RAD50 /DK / ;File descriptor for work file
.RAD50 /WRK / ; "DK " is changed to "WF " if WF: is
.RAD50 /TMP/ ; assigned.
.PSECT PATCH,D,RW,GBL ;RT-11 patch psect
PATCH:: .BLKW 64.
.PSECT IMPPAS,D,GBL,RW ;
LPPCNT::.BLKW 1 ;Force new page when negative
FFCNT:: .BLKW 1 ;Unprocessed <FF> count
PAGNUM::.BLKW 1 ;Page number
PAGEXT::.BLKW 1 ;Page extension
.IF NDF XLCSEQ
LINNUM::.BLKW 2 ;Cref line number
SEQEND::.BLKW 1 ;
.ENDC
.ENDC; DF,RT11 ;If RT-11
.SBTTL IMPPAS psect data (Cleared on start of a pass)
.PSECT IMPPAS,D,GBL,RW
;Next group must stay together
SYMBOL::.BLKW 2 ;Symbol accumulator
MODE:: ;Mode/Flags byte
FLAGS:: .BLKB 1 ;
SECTOR::.BLKB 1 ;Symbol/Expression type
VALUE:: .BLKW 1 ;Expression value
RELLVL::.BLKW 1 ;Relocation level
CLCNAM::.BLKW 2 ;Current location counter name
CLCFGS::.BLKB 1 ;
CLCSEC::.BLKB 1 ;
CLCLOC::.BLKW 1 ;
CLCMAX::.BLKW 1 ;
CHRPNT::.BLKW 1 ;Character pointer
SYMBEG::.BLKW 1 ;Pointer to start of symbol
ENDFLG::.BLKW 1 ;
SYMEND::.BLKW 1 ;Pointer to end of symbol scanned with GETSYM
;+
; Argument storage for current macro expansion context
;-
ARGMX:: .BLKW 1 ;Count nubmer of arguments passed to macro
;ARGVC::.BLKB 96. ;List of offsets into arg string by arg number[-GTS]
ARGVC:: .BLKB 126. ;List of offsets into arg string by arg number[+GTS]
;ARGST::.BLKW 96. ;Buffer for arguments to macro invocation [-GTS]
ARGST:: .BLKW 125. ;Buffer for arguments to macro invocation [+GTS]
GETFLG::.BLKW 1 ;File crossing enable (0=YES)
;?This word is questionable under RT-11
.SBTTL Assembler pass control
PURE PUREI,I
MACP2:: CALL XCTPAS ;Setup for pass two
MACP2F::CALL SECINI ;Initialize sector roll
COMB LIBNUM ;Set current library number to minus.
10$: CALL GETLIN ;Get the next input line
BNE 20$ ;Branch if eof
CALL STMNT ;Else process the statement
20$: CALL ENDLIN ;Polish off line
TST ENDFLG ;End seen?
BEQ 10$ ;Branch if not continue
RETURN
.SBTTL Overlay root magic stuff
PURE PUREI,I
RESTO:: INC R3 ;Flag .RESTORE
CALLR SAVE ;and go do it.
BLKW:: INC R3 ;Indicate "BLKW"
CALLR BLKB ;and go do it
NOCRO:: INC R3 ;Indicate ".NOCROSS"
CALLR CROSS
EVEN:: INC @R2 ;Increment PC
BIC #1,@R2 ;Force it even
RETURN ;
ODD:: BIS #1,@R2 ;Force odd PC
EOT:: RETURN ;
ASCIZ:: INC R3 ;Indicate "ASCIZ"
ASCII:: INC R3 ;Indicate "ASCII"
CALLR RAD50 ;Jump to common code
WORD:: INC R3 ;Indicate "WORD"
CALLR BYTE ;Jump to common code
DSABL:: COM R3 ;Indicate "DSABL"
CALLR ENABL ;Jump to common code
NLIST:: COM R3 ;Indicate "NLIST"
CALLR LIST ;Jump to common code
IRPC:: INC R3 ;Indicate "IRPC"
CALLR IRP ;Jump to common code
.ENABL LSB
MEXIT:: MOV MACLVL,CNDMEX ;Are we in a macro?
BNE 10$ ;Branch if so, OK.
OPCERR::ERROR O ;Else OP-CODE error
10$: RETURN ;
.DSABL LSB
.IF NDF,RT11 ;If not RT-11
; These entry points are included
; since PST REFRESH and FLOAT are
; on parallel overlay segments.
FLT4:: INC R3 ;Indicate 4 word
FLT2:: INC R3 ;Indicate 2 word
CALLR FLOAT ;Call floating point overlay
.ENDC; NDF,RT11
.SBTTL Impure line data
.PSECT IMPLIN,D,GBL,RW
OPCLAS::.BLKW 1 ;OP Code class
BYTMOD::.BLKW 1 ;BYTE Mode when <> 0
.SBTTL Some root code
PURE PUREI,I
; Impure line data psect initialization code
XCTLIN::MOV #IMPLIN,R0 ;Zap the whole Impure line psect
10$: CLR (R0)+ ;...
CMP #IMPLIT,R0 ;At the end yet?
BHI 10$ ;Branch if not
RETURN ;Return to caller
; Set expression registers
SETXPR::MOV #SYMBOL,R1 ;Load up R1 - R4 with correct contents
MOV #SECTOR,R2
MOV #MODE,R3
MOV #VALUE,R4
RETURN ;Return to caller
; Save registers R1 - R4 as a co-routine.
SAVREG::MOV R3,-(SP)
MOV R2,-(SP)
MOV R1,-(SP)
MOV 6.(SP),-(SP) ;Place return address on top
MOV R4,8.(SP)
CALL @(SP)+ ;Return the call
MOV (SP)+,R1 ;Restore registers
MOV (SP)+,R2
MOV (SP)+,R3
MOV (SP)+,R4
TST R0 ;Set condition codes
RETURN
; Generate argument transmition subroutine
.REPT <BPMB/2>-7
MOV (R1)+,(R2)+ ;Pad to max needed
.ENDR
XMIT7:: MOV (R1)+,(R2)+ ;Move vector ...
XMIT6:: MOV (R1)+,(R2)+ ;
XMIT5:: MOV (R1)+,(R2)+ ;
XMIT4:: MOV (R1)+,(R2)+ ;
XMIT3:: MOV (R1)+,(R2)+ ;
XMIT2:: MOV (R1)+,(R2)+ ;
XMIT1:: MOV (R1)+,(R2)+ ;
XMIT0:: RETURN ;and return to caller
;+
; MOVBYT
; General move .ASCIZ string routine
;
; R1 -> Input string
; R2 -> Output buffer
;
; CALL MOVBYT
;
; R1 -> Past zero byte
; R2 -> Zero byte in output buffer
;
;-
MOVBYT::MOVB (R1)+,(R2)+ ;Move a byte
BNE MOVBYT ;Branch if not the end
TSTB -(R2) ;Else point back to null
RETURN ;
;+
; $CVRL2
; This routine is a substitute for CVRL, that simply saves
; register R2.
;-
$CVRL2::MOV R2,-(SP) ;Save R2
CALL $CVRL ;Convert virt locn to real ...
;Addr (clobbers R2)
MOV (SP)+,R2 ;Restore R2
RETURN ;
.SBTTL
.SBTTL
.SBTTL Software channel data
.SBTTL
.SBTTL
.SBTTL IOFTBL bit definitions
.PSECT ..IO..,RW,D,GBL,ABS,OVR ;I/O Flag definitions
IO.NNU==.+000001 ;I/O Flags
IO.TTY==.+000002 ;Device is teletype
.IF DF,RT11 ;If RT-11
IO.EOF==.+000004 ;EOF Flag
.ENDC; DF,RT11 ;If RT-11
IO$EOF==.+000004 ;EOF Flag
IO.ERR==.+000010 ;Error encountered
IO.OPN==.+000020 ;Open flag
IO$RBG==.+000040 ;Record too big error detected
IO.OUT==.+100000 ;Output device
.SBTTL I/O Status tables
.IF DF,RT11 ;If RT-11
.PSECT IMPURE,D,GBL,RW
RECNUM::.BLKW MAXCHN/2 ;Record number
.IFF; DF,RT11 ;If RT-11
.PSECT MIXED,RW,D
.IFTF; DF,RT11 ;If RT-11
IOFTBL::.BLKW MAXCHN/2 ;I/O Flag table
PURE DPURE,D
.IFT; DF,RT11 ;If RT-11
; Length table (RT-11)
.MACRO SETCHN ZCHAN,ZBUF,ZBLK,ZRTCHN,ZTYPE
.LIST
.BYTE ZBUF'LEN,ZTYPE
.NLIST
.ENDM SETCHN
IOLTBL::
GENCHN
.IFTF; DF,RT11 ;If RT-11
; Byte count table
.IFT; DF,RT11 ;If RT-11
.MACRO SETCHN ZCHAN,ZBUF,ZBLK,ZRTCHN,ZTYPE
.LIST
.WORD ZCHAN'DAT
.NLIST
.ENDM SETCHN
.IFF; DF,RT11 ;If RT-11
.MACRO SETCHN ZCHAN,ZBUF,ZFDB
.LIST
.WORD ZBUF'BUF-2 ;ZCHAN'CHN
.NLIST
.ENDM SETCHN
.IFTF; DF,RT11 ;If RT-11
CNTTBL::
GENCHN
; Buffer pointer table
.IFT; DF,RT11 ;If RT-11
.MACRO SETCHN ZCHAN,ZBUF,ZBLK,ZRTCHN,ZTYPE
.LIST
.WORD ZBUF'BUF
.NLIST
.ENDM SETCHN
.IFF; DF,RT11 ;If RT-11
.MACRO SETCHN ZCHAN,ZBUF,ZFDB
.LIST
.WORD ZBUF'BUF ;ZCHAN'CHN
.NLIST
.ENDM SETCHN
.PSECT MIXED,D,RW
.IFTF; DF,RT11 ;If RT-11
BUFTBL::
GENCHN
.IFT; DF,RT11 ;If RT-11
; Miscellaneous I/O buffers
.MACRO SETCHN ZCHAN,ZBUF,ZBLK,ZRTCHN,ZTYPE
.LIST
.IF NZ,ZTYPE
.WORD ZTYPE ;Protocol words for binary output
.WORD 0
.ENDC; NZ,ZTYPE
ZBUF'BUF::.BLKW <ZBUF'LEN+1>/2
.NLIST
.ENDM SETCHN
.PSECT MIXED,D,RW,LCL
; GENCHN
.WORD 1 ;Protocol words for binary output
.WORD 0
OBJBUF::.BLKW <OBJLEN+1>/2
.WORD 1
.WORD 0
RLDBUF::.BLKW <RLDLEN+1>/2
.IF NDF XCREF
CRFBUF::.BLKW <CRFLEN+1>/2
.ENDC
PTRTBL==.+4
BLKTBL==.+6
.MACRO SETCHN ZCHAN,ZBUF,ZBLK,ZRTCHN,ZTYPE
.LIST
ZCHAN'DAT::.WORD 0
.WORD ZBUF'BUF
.WORD 0
.IF NB,ZBLK
.WORD ZBLK'BLK
.IFF; NB,ZBLK
.WORD 0
.ENDC; NB,ZBLK
.NLIST
.ENDM SETCHN
GENCHN
.MACRO SETCHN ZCHAN,ZBUF,ZBLK,ZRTCHN,ZTYPE
.LIST
.WORD ZRTCHN
.NLIST
.ENDM SETCHN
CHAN::
GENCHN
.IFF; DF,RT11 ;If RT-11
; Miscellaneous i/o buffers
.PSECT IMPURE,D,RW
.BLKW 1
OBJBUF::.BLKW <OBJLEN+1>/2 ;Object text code buffer
.BLKW 1
RLDBUF::.BLKW <RLDLEN+1>/2 ;Object RLD/GSD code buffer
CMIBUF::.BLKB 2 ;Two bytes of GCML overhead.
.BLKB 132. ;Command input (GCML) buffer
.BLKB 2 ;+ 1 rounded byte for SETDN's .ASCIZ punch.
.BLKW 1
CRFBUF:: ;Buffer we send to CRF
$CRSYM::.BLKW 2 ;Symbol name
$CRREF::.BLKW 2 ;Ref data (page-line numbers)
$CRVAL::.BLKW 1 ;Symbol value
$CRATT::.BLKB 1 ;Flags byte
$CRFMT::.BLKB 1 ;Format number
; Switch word
$SWTCH::.BLKW 1 ;
; CSI Control block
CSIBLK::.BLKB C.SIZE ;CSI Block
; FDB Pointer table
.PSECT MIXED,D,RW
.MACRO SETCHN ZCHAN,ZBUF,ZFDB
.LIST MEB
.IF NB,<ZFDB>
.WORD ZCHAN'FDB ; ZCHAN'CHN
.IFF; NB,<ZFDB>
.WORD 0 ; ZCHAN'CHN
.ENDC; NB,<ZFDB>
.NLIST MEB
.ENDM SETCHN
OBJCHN=BINCHN
FDBTBL::
GENCHN
CMLBLK::
GCMLB$ ILVL,MAC,CMIBUF,SIZE=132. ;Normal gcml block
FDB1:: FDBDF$ ;FDB For use on either object ...
; or listing file
RELFDB = FDB1 ;When an object file is created ...
; it always uses this FDB
FDB2: FDBDF$
FDB3: FDBDF$
$NXFDB::.WORD 0 ;Pointer to next available FDB
$FDBLS::.WORD FDB1 ;List of available FDB'S
.WORD FDB2 ;...
.WORD FDB3 ;...
$XFDB:: .WORD 0 ;If needed, this FDB is allocated
; from dynamic memory.
TMP=3 ;Reserve FSR'S for 3 active files
.IF NDF,R$RSTS ;IF NOT RSTS/E
.IIF DF,RSX11M,TMP=TMP-1 ;1 Less if .LST file remains closed
.ENDC; NDF,R$RSTS ;IF NOT RSTS/E
FSRSZ$ TMP ;Reserve file storage regions (FSR'S)
;For 2 or 3 active files.
.ENDC; DF,RT11 ;If RT-11
.SBTTL RSDAT - Resident data base for overlays
; Conditional storage (CNDTL)
.PSECT IMPPAS,D,GBL,RW
CNDWRD::.BLKW 1 ;Test word
CNDMSK::.BLKW 1 ;Condition mask
CNDLVL::.BLKW 1 ;Nesting level
CNDMEX::.BLKW 1 ;Mexit flag
; Data directive storage (DATDR)
.PSECT IMPPAS,D,GBL,RW
CRADIX::.BLKW 1 ;Current radix
.IF DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW,GBL
.IFF; DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW
.ENDC; DF,RT11 ;If RT-11
$PRTLN::.BLKB 1 ;<> 0 Says to print LINBUF w/error msg.
.BLKB 1 ;RESERVED
PRGTTL::.BLKW 4 ;Ident block
PRGIDN::.BLKW 4 ;
;
; .ENABL/.DSABL Storage (ENBDS)
;
; Generate .ENABL/.DSABL argument roll
;
; GENEDT MNE,SUBR,INIT
;
; Where:
;
; MNE =Is a 1 to 3 character argument mneumonic.
; SUBR =The address of a subroutine to be called
; when argument mneumonic is encountered.
; This argument is optional.
; INIT =If non-null, then default is disable.
;
.PSECT ..ED..,ABS,D,GBL,OVR
..ED..:
.MACRO GENEDT MNE,SUBR,INIT
.RAD50 /MNE/
.IF NB,<SUBR>
.WORD SUBR
.IFF; NB,<SUBR>
.WORD EDRTN
.ENDC; NB,<SUBR>
ED.'MNE==TMP+..ED..
TMP=TMP+TMP
.IF NB,<INIT>
.LIST
; ".DSABL MNE" is the default
.NLIST
EDINIT==EDINIT ! ED.'MNE
.ENDC; NB,<INIT>
.ENDM GENEDT
TMP=1 ;Init bit mask generator
EDINIT==0 ;Init .ENABL/.DSABL control bits
PURE EDTSEC,D,GBL
EDTBAS::
.IF NDF,XEDABS
GENEDT ABS,SECINI,F ;ABS binary output
.ENDC; NDF,XEDABS
.IF NDF,XEDAMA
GENEDT AMA,,F ;Change all mode 67 to mode 37
.ENDC; NDF,XEDAMA
.IF NDF,XEDBMK
GENEDT BMK,ENABMK,F ;MACRO regression benchmark
.ENDC; NDF,XEDBMK
.IF NDF,XEDCDR
GENEDT CDR,,F ;Ignore collums 73 - [EOL]
.ENDC; NDF,XEDCDR
GENEDT CRF ;Cross reference
.IF NDF,XISD
GENEDT DBG,,F ;ISD Record support (DEBUG-16 or MpPASCAL)
.ENDC; NDF,XISD
.IF NDF,XEDFPT
GENEDT FPT,,F ;Floating point truncation mode
.ENDC; NDF,XEDFPT
GENEDT GBL ;GBL enabled by default
GENEDT LC ;Enable lower case is now the default
GENEDT LCM,,F ;Disable lower-case-check for IDN/DIF
GENEDT LSB,LSBTST,F ;Local symbol block crossing
GENEDT MCL,,F ;AutoMcall feature
.IF NDF,XEDPIC
GENEDT PIC,,F ;If enabled - Macro gives "R" errors
.ENDC; NDF,XEDPIC ;on non-pic instructions.
.IF NDF,XEDPNC
GENEDT PNC,PNCSET ;Enable binary output
.ENDC; NDF,XEDPNC
GENEDT REG ;Enable standard register definitions
EDTTOP:: ;Top of .ENABL/.DSABL stuff
;+
; Process .ENABL/.DSABL LSB Directives
;
; NOTE: This code may be allocated into an overlay segment
; containing the module 'ENBDS' without paying for
; unnecessary auto-load vectors.
;-
PURE LSBTST,I,GBL
LSBTST: BNE EDRTN ;Just return if .DSABL requested
CLR LSFLAG ;Else clear auto-generated symbol base
; ... and flag need for new LSY block.
EDRTN: RETURN ;
.IF DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW,GBL
.IFF; DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW
.ENDC; DF,RT11 ;If RT-11
EDMASK::.BLKW 1 ;Contains set bits
EDMCSI::.BLKW 1 ;Bits for CSI override
EDMBAK::.BLKW 1 ;For re-init in pass two
; Floating point storage (FLOAT)
.PSECT IMPLIN,D,GBL,RW
FLTWDC::.BLKW 1 ;Word count
.IF DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW,GBL
FLTBEG:: ;Start of floating point impure area
FLTSGN::.BLKW ;Sign bit
FLTDOT::.BLKW ;Decimal point flag
FLTEXP::.BLKW ;Decimal exponent
FLTBEX::.BLKW 1 ;Binary exponent (Must precede FLTBUF)
FLTBUF::.BLKW 4 ;Main AC
FLTSAV::.BLKW 4 ;
; Expression evaluation (EXPRS)
.PSECT IMPURE,D,RW,GBL
EXPBAK::.BLKW 5 ;Previous term storage
; File initialization storage (INOFL)
.PSECT IMPURE,D,RW,GBL
LIBCNT::.BLKB 1 ;Macro library count
MLCHN:: .BLKB 9.-1 ;User macro library file channel
; save area = MAXCHN-1 long.
MLCEN:: ;End of MLB chn table
.EVEN
.ENDC; DF,RT11 ;If RT-11
; Listing control storage (LISTC)
.PSECT ..LC..,ABS,D,GBL,OVR
..LC..:
; Local macro
.MACRO GENLCT MNE,INIT
.RAD50 /MNE/
LC.'MNE==TMP+..LC..
TMP=TMP+TMP
.IF NB,<INIT>
.LIST
; ".NLIST MNE" IS DEFAULT
.NLIST
LCINIT==LCINIT ! LC.'MNE
.ENDC; NB,<INIT>
.ENDM GENLCT
TMP=1 ;Init bit mask generator
LCINIT==0 ;Init listing control bits
PURE LCTSEC,D,GBL
;CAUTION: Table is order dependent.
LCTBAS:: ;
GENLCT < > ;
GENLCT BEX ;
GENLCT BIN ;
GENLCT CND ;
GENLCT COM ;
.IF DF,YHEX
GENLCT HEX, F ;Enable HEX listings - LCMASK only
.ENDC; DF,YHEX
GENLCT LOC ;
GENLCT MC ;
GENLCT MD ;
GENLCT ME, F ;
GENLCT MEB, F ;
GENLCT SEQ ;
GENLCT SRC ;
GENLCT SYM ;
GENLCT TOC ;
GENLCT TTM, F ;
TMP=LC.HEX-..LC..
GENLCT LD, F ;LCFLAG only not used for LCMASK
LCTTOP:: ;Top of .list/.nlist stuff
.IF DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW,GBL
.IFF; DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW
.ENDC; DF,RT11 ;If RT-11
LCSAVE:: ;Listing control save block
LCMASK::.BLKW 1 ;Mask bits
LCLVL:: .BLKW 1 ;Level count
LCMCSI::.BLKW 1 ;CSI Override bits
LCSAVL==.-LCSAVE
LCSBAK::.BLKW LCSAVL/2 ;For initing pass two
.PSECT IMPLIN,D,GBL,RW
LCFLAG::.BLKW 1 ;Flag bits
LCBEGL::.BLKW 1 ;Pointer to start of line
LCENDL::.BLKW 1 ;Pointer to end of line
LBLEND::.BLKW 1 ;End of label (For parsing)
; Macro procesing storage (MACRS)
M$FLAG==40 ;Bit set in PST entry if macro name instead
; of opcode
.PSECT IMPPAS,D,GBL,RW
; .INCLUDE Stack
.IF NDF,RT11 ;If not RT-11
INCSIZ == 9. ;Size of a .INCLUDE stack frame.
.IFF; NDF,RT11 ;If not RT-11
INCSIZ == 8. ;Size of a .INCLUDE stack frame.
.IFTF; NDF,RT11 ;If not RT-11
INCSP:: .BLKW 1 ;Directive .INCLUDE stack pointer
.IFT; NDF,RT11 ;If not RT-11
INCSTK::.BLKW <INCLVL*INCSIZ>+INCSIZ ;.INCLUDE stack (INCLVL entries)
INCSTT:: ;End of .INCLUDE stack label.
.BLKB 1 ;RESERVED
.IFF; NDF,RT11 ;If not RT-11
INCSTK::.BLKW <INCLVL*INCSIZ> ;.INCLUDE stack (INCLVL entries)
INCSTT:: ;End of .INCLUDE stack label.
INCFLG::.BLKB 1 ;New .INCLUDE file flag for MACRO/RT only.
.ENDC; NDF,RT11 ;If not RT-11
LIBNUM::.BLKB 1 ;# of current macro library file
SMLLVL::.BLKW 1 ;Mcall hit count
.IF DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW,GBL
.IFF; DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW
.ENDC; DF,RT11 ;If RT-11
MSBBLK:: ;Pushable block (Must be ordered)
MSBTYP::.BLKW 1 ;Block type
MSBPBP::.BLKW 1 ;Previous block pointer
MSBTXT::.BLKW 1 ;Pointer to basic text block
MSBARG::.BLKW 1 ;Pointer to argument block
MSBCNT::.BLKW 2 ;Repeat count etc.
MSBMRP::.BLKW 1 ;Macro read pointer
MSBRDV::.BLKW 1 ;Virt locn of text BLK being read
MSBEND:: ;End of ordered block
MSBLGH==MSBEND-MSBBLK ;Length of pushable storage
.IIF GT <MSBLGH-BPMB>, .ERROR ;Macro context too long
MACNXT::.BLKW 1 ;
MACLVL::.BLKW 1 ;Macro nesting level
CONCNT::.BLKW 1 ;
ARGMAX::.BLKW 1 ;
MACNAM::.BLKW 2 ;Macro name
MACGSB::.BLKW 1 ;Macro generated symbol bits
MACWRT::.BLKW 1 ;Addr of text block being written
MACTXT::.BLKW 1 ;Addr of basic text block
MACWTV::.BLKW 1 ;Virt locn of BLK being written
; Miscellaneous directive storage (MSCDR)
.IF DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW,GBL
FFLOC:: .BYTE CR,LF ;(EGP) Form feed byte init to <CR><LF>.
.IFF; DF,RT11 ;If RT-11
.PSECT IMPURE,D,RW
.ENDC; DF,RT11 ;If RT-11
ENDVEC::.BLKW 4 ;End vector storage
TTLBRK::.BLKW 1 ;Break location
TTLBUF::.BLKB TTLLEN-1!7+1+1 ;Modulo TAB+FF
.BLKB 20. ;Intro msg
.BLKB 26. ;Time & Date (Global size = DATSIZ)
; From DATSUB.MAC.
.BLKB 21. ;Page number
.EVEN
.PSECT IMPPAS,D,GBL,RW
STLBUF::.BLKW <STLLEN+2>/2 ;Sub title buffer
; Switch processing storage (PROSW)
.PSECT IMPLIN,D,GBL,RW
EXMFLG::.BLKW 1 ;Exec mode flag
; Program section storage (SECTR)
.PSECT MIXED,D,RW
$NAMSC::.BLKW NU$SEC*2 ;In-core psect name table
.IF DF,RT11 ;If RT-11
; Cref storage (RT-11)
.PSECT MIXED,D,RW,LCL
CRF.DEV::.RAD50 /DK /
.PSECT IMPURE,D,RW,GBL
CRFFLG::.WORD 0
PURE CRFTYP,D,GBL
CRFTYP::
ERRROL==1 ;Fake error roll index for cref only
REGROL==3 ;Fake register roll index for cref only
SYMLST==5 ;Fake list for symbols
PSTROL==7 ;Fake roll for permanent symbols
MACLST==11 ;Fake list for macro names
.BYTE SYMLST,<0*40>+<'S&37>
.BYTE REGROL,<1*40>+<'R&37>
.BYTE MACLST,<2*40>+<'M&37>
.BYTE PSTROL,<3*40>+<'P&37>
.BYTE SECLST,<4*40>+<'C&37>
.BYTE ERRROL,<5*40>+<'E&37>
.PSECT IMPLIN,D,RW
CRFDFL::.WORD 0 ;Destructive ref save byte
.IFF; DF,RT11 ;If RT-11
; Cref storage (RSX-11)
.MACRO GENCRT MNE,NDX
.BYTE NDX
CR.'MNE==TMP
TMP=TMP+TMP
MNE'$FM==TMP2
TMP2=TMP2+1
.ENDM GENCRT
TMP=1 ;Init bit mask generator
TMP2=0 ;Init crf format counter
PURE CRFTBL,D,GBL
$CRTBL::
GENCRT SYM,SYMLST ;
GENCRT REG,REGROL ;
GENCRT MAC,MACLST ;
GENCRT PST,PSTROL ;
GENCRT SEC,SECLST ;
GENCRT ERR,ERRROL ;
.MACRO GENCRF MNE,INIT
.RAD50 /MNE/
.WORD CR.'MNE
.IF NB,<INIT>
.LIST
; "/CR:MNE" IS DEFAULT
.NLIST
CRINIT=CRINIT!CR.'MNE
.ENDC; NB,<INIT>
.ENDM GENCRF
; Fake roll index numbers for cref references
; (These lists were replaced by the hash table)
ERRROL==1 ;Fake error roll index for cref only
REGROL==3 ;Fake register roll index for cref only
SYMLST==5 ;Fake list for symbols
PSTROL==7 ;Fake roll for permanent symbols
MACLST==11 ;Fake list for macro names
CRINIT==0 ;Init default cref control mask
PURE CRFSEC,D,GBL
CRFBAS::
GENCRF MAC,1 ;
GENCRF PST ;
GENCRF REG ;
GENCRF SYM,1 ;
GENCRF SEC ;
GENCRF ERR,1 ;
CRFTOP::
.PSECT IMPURE,D,RW
CRMASK::.BLKW 1 ;Cref option control word
$LSTGT::.BLKW 2 ;LST File target device
CRFDFL::.BLKB 1 ;Destructive ref save byte
CRFFIL::.BLKB 1 ;CRF File creation flag
; Symbol flags used by CRF
CR$BTS==DFGFLG!GLBFLG!LBLFLG!REGFLG!RELFLG!DEFFLG
CR$DEF==CPXFLG ;CRF Defn record flag
CR$DRF==MDFFLG ;CRF Destructive ref flag
.ENDC; DF,RT11 ;If RT-11
; Get macro argument storage (GMARG)
.PSECT IMPPAS,D,GBL,RW
GMAPNT::.BLKW 1 ;Pointer to following buffer
GMABLK::.BLKW 1 ;Pointer to borrowed character
.BLKW 1 ;Character itself
.BLKW 3*2 ;Room for more pairs
; Virtual memory data
S$V2 == 2 ;Error severity (FATAL)
E$R4 == 1 ;Corresponds to message 'VIRTM1'
E$R73 == 2 ;Corresponds to message 'VIRTM2'
E$R76 == 3 ;Corresponds to message 'VIRTM3'
.PSECT MIXED,D,RW
$FRHD:: .BLKW 2 ;Free memory list head
.IF DF,RT11 ;If RT-11
$FRNM:: .BLKW 1 ;Count of page buffers in freelist
$FRAVL::.BLKW 1 ;Number of page buffers initially available
$RMSIZ::.BLKW 1 ;Size of available real memory
$HIGHI::.BLKW 1 ;High limit of I/O buffers and drivers,
; as set by INOFL.RT.
PURE DPURE,D
$LIMIT::.LIMIT ;Task address limits: Begin,end
.PSECT MIXED,D,RW
.IFF; DF,RT11 ;If RT-11
$FRSIZ::.BLKW 1 ;Size of real memory available
; The following data belongs in MACINI - but SAV psects don't work right!
$EXSTS::.WORD EX$SUC ;Exit status of MACRO-11/RSX
$INIT:: .WORD 0 ;<>0 if MACINI has been called once
$RDID::.BLKW 5 ;SAVE ID FOR LB:[1,1]
$PDID::.BLKW 5 ;SAVE ID FOR LB:[1,5]
$IDSIZ == . - $RDID ;SIZE TO ZERO
$MACPR::.ASCII <CR><LF>/MAC>/ ;Prompt string
; (Name gets overlaid dyamically)
.EVEN
; RSX-11 Error messages
;+
; .ASCID
; Generate a ASCII descriptor string.
;-
.MACRO .ASCID STRING
.NCHR ......,<STRING>
.BYTE ......
.ASCII ~STRING~
.ENDM .ASCID
PURE ERRMSG,D,GBL
OUTM1:: .ASCID < -- I/O error on output file>
INPM1:: .ASCID < -- I/O error on input file>
CSIM2:: .ASCID < -- Command syntax error>
CSIM3:: .ASCID < -- Invalid filename>
CSIM4:: .ASCID < -- Invalid switch>
CSIM5:: .ASCID < -- Open failure on output file>
CSIM6:: .ASCID < -- Open failure on input file>
CMLM2:: .ASCID < -- Command I/O error>
CMLM3:: .ASCID < -- Command file open failure>
CMLM4:: .ASCID < -- Indirect command syntax error>
CMLM5:: .ASCID < -- Indirect file depth exceeded>
LIBM1:: .ASCID < -- Invalid format in macro library>
LIBM2:: .ASCID < -- I/O error on macro library file>
VIRTM1::.ASCID < -- Insufficient dynamic memory>
VIRTM2::.ASCID < -- I/O error on work file>
VIRTM3::.ASCID < -- 64K storage limit exceeded>
.ENDC; DF,RT11 ;If RT-11
.END