Trailing-Edge
-
PDP-10 Archives
-
bb-d868e-bm_tops20_v41_2020_dist_1of2
-
4-1-sources/makram.mac
There are 21 other files named makram.mac in the archive. Click here to see a list.
;<5.UTILITIES>MAKRAM.MAC.2, 28-Oct-81 15:22:41, EDIT BY GRANT
;Change major version to 5
;<4.UTILITIES>MAKRAM.MAC.3, 3-Jan-80 15:26:01, EDIT BY R.ACE
;UPDATE COPYRIGHT DATE
;<4.UTILITIES>MAKRAM.MAC.2, 10-Mar-79 14:08:01, EDIT BY KONEN
;UPDATE COPYRIGHT FOR RELEASE 4
;<4.UTILITIES>MAKRAM.MAC.1, 23-Jan-79 16:11:15, Edit by KONEN
;UPDATE VERSION NUMBER FOR RELEASE 4
TITLE MAKRAM - PROGRAM TO MAKE BINARY RAM FILE FOR LP20
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976,1977,1978,1979,1980 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
SEARCH MONSYM,MACSYM
.REQUIRE SYS:MACREL
SALL
IFDEF .PSECT,<
.DIRECT FLBLST>
IFNDEF .PSECT,<
.DIRECT .XTABM>
;THIS PROGRAM ACCEPTS TEXT INPUT DESCRIBING TRANSLATION ACTION
;TO BE PERFORMED ON CERTAIN ASCII CHARACTERS. AN INITIAL RAM IS
;ASSEMBLED IN WHICH CORRESPONDS TO THE STANDARD BA10 TRANSLATION
;ALGORITHM FOR A 96 CHARACTER LP10.
; VERSION INFORMATION
VMAJOR==5 ;MAJOR VERSION
VMINOR==0 ;MINOR VERSION
VWHO==0 ;WHO LAST EDITED (0=DEC DEVELOPMENT)
VEDIT==2 ;EDIT NUMBER
VMAKTR== <VWHO>B2+<VMAJOR>B11+<VMINOR>B17+VEDIT
;DEFINTIONS
A==1
B==2
C==3
D==4
W1==5
W2==6
P==17
BUFSIZ==100
NCHPW==5
ATMSIZ==100
GJFSIZ==.GJRTY+2
DEFINE TXTPTR (MSG) <POINT 7,[ASCIZ /MSG/]>
DEFINE RAMWRD (TYPE,DATUM) <
IFE TYPE-OTHER,<
..T==TRNBIT+DATUM ;;TRANSLATE TO OTHER
>
IFE TYPE-ARROW,<
..T==INTBIT+"^" ;;FORM DATUM WORD
> ;;END OF ARROW TRANSLATION
IFE TYPE-SELF,<
..T==TRNBIT+BYTE ;;TRANSLATE TO SELF
>
IFE TYPE-PAPER,<
..T==VFUBIT+<DATUM-1> ;;PAPER MOTION
>
IFE TYPE-DEL,<
..T==DELBIT ;;DELIMITER
>
IFE TYPE-IGNORE,<
..T==TRNBIT+0 ;;SEND NON-PRINTING CHARACTER
>
IFE TYPE-IMAGE,<
..T==DATUM ;;PROVIDE BINARY QUANTITY
>
IFE BYTE&1,< .T==..T_^D18>
IFN BYTE&1,< .T+..T> ;;GENERATE WORD
BYTE==BYTE+1 ;;NEXT BYTE
> ;;END OF MACRO
;DEFINITIONS FOR THE ABOVE MACRO
PAPBIT==1B27 ;PAPER MOTION BIT
DELBIT==1B25 ;DELIMITER BIT
ARROW==0 ;ARROW MODE
SELF==1 ;TRANSLATE TO SELF
TRNBIT==1B26 ;TRANSLATE BIT
INTBIT==1B24 ;PAPER BIT
PAPER==2 ;PAPER MOTION CHARATCER
VFUBIT==PAPBIT+TRNBIT
DEL==3 ;DELIMITER
DELBIT==1B25
OTHER==4
IGNORE==5 ;IGNORE THIS CODE
IMAGE==6 ;DATUM IS FULL DESCRIPTION
;DATA
CMDBLK: BLOCK .CMGJB+5 ;COMD STATE BLOCK
ATMBFR: BLOCK ATMSIZ ;ATOM BUFFER
GJFBLK: BLOCK GJFSIZ ;GTJFN LONG FORM BLOCK
EIGHTB: BLOCK 1 ;0: 7 DATA BITS, 1: EIGHT DATA BITS
PDLN==50 ;LENGTH OF PDL
PDL: BLOCK PDLN ;ALLOCATE PDL
BUFFER: BLOCK 100 ;RESERVE LINE SPACE
SUBTTL GENERATE THE RAM
BYTE==0 ;START AT 0
.T==0 ;INITIALIZE
..T==0
PRAM: RAMWRD SELF ;NULL GOES TO SELF
REPEAT ^D8,<RAMWRD ARROW> ;1-10 IS ARROW MODE
RAMWRD SELF ;TAB GOES TO SELF
RAMWRD PAPER,^D8 ;LF IS VERT MOTION
RAMWRD PAPER,7 ;VT IS CHANNEL 7
RAMWRD PAPER,1 ;FF IS TOP OF FORM
RAMWRD PAPER,1B31+1 ;SPACE 0 LINES
REPEAT 2,<RAMWRD ARROW> ;16-17 ARROW TRANSLATION
RAMWRD PAPER,2 ;20 VFU CH 2
RAMWRD PAPER,3 ;21 VFU CH 3
RAMWRD PAPER,4 ;22 VFU CH 4
RAMWRD PAPER,5 ;23 VFU CH 5
RAMWRD PAPER,6 ;24 VFU CH 6
REPEAT 6,<RAMWRD ARROW> ;25-32 ARROW MODE
RAMWRD OTHER,"$" ;33 PRINTS AS $
REPEAT 4,<RAMWRD ARROW> ;34-37 ARROW MODE
REPEAT 177-40,<
RAMWRD SELF> ;ALL REST GO TO SELF
RAMWRD IGNORE ;EXCEPT DELETE, WHO HAD NONE!!!!
;NOW GENERATE BLOCK TO HOLD BUILT RAM
RAM: BLOCK 200 ;THE RAM
RELOC 2000-140 ;START THE CODE
; ENTRY VECTOR DEFINITION
ENTVEC: JRST START
JRST START
EXP VMAKTR
CMDTAB: ELEV1-.-1,,ELEV1-.-1
XWD [ASCIZ /ARROW-MODE/],AROW
XWD [ASCIZ /DELIMITED-TRANSLATE/],DTRANS
XWD [ASCIZ /EXIT/],.EXIT
XWD [ASCIZ /HELP/],.HELP
XWD [ASCIZ /LOWER-CASE/],LOWER
XWD [ASCIZ /NUMBER-OF-DATA-BITS/],NDBITS
XWD [ASCIZ /OUTPUT/],OUTPUT
XWD [ASCIZ /TRANSLATE/],TRANS
XWD [ASCIZ /UPPER-CASE/],UPPER
ELEV1:
PROMPT: ASCIZ /MAKRAM>/
HLPTXT: ASCIZ /NEW?/
SUBTTL COMMAND PARSER AND DISPATCH
START: RESET ;CLEAN UP
MOVE A,[PRAM,,RAM] ;MOVE PROTOTYPE RAM
BLT A,RAM+77 ;DO FIRST 200 CHARACTERS
MOVE A,[PRAM,,RAM+100]
BLT A,RAM+177 ;DO SECOND 200 CHARACTERS
SETZM EIGHTB ;ASSUME 7 DATA BITS
HRROI A,PROMPT ;GET POINTER TO PROMPT STRING
MOVEM A,CMDBLK+.CMRTY ;PUT RE-TYPE PROMPT POINTER IN STATE BLOCK
HRROI A,BUFFER ;GET POINTER TO INPUT TEXT BUFFER
MOVEM A,CMDBLK+.CMPTR ;SAVE POINTER TO COMMAND STRING
MOVEM A,CMDBLK+.CMBFP ;SAVE POINTER TO START-OF-BUFFER
MOVE A,[.PRIIN,,.PRIOU] ;GET PRIMARY INPUT,, OUTPUT JFN'S
MOVEM A,CMDBLK+.CMIOJ ;SAVE PRIMARY JFN'S
MOVEI A,PARSE1 ;GET RE-PARSE ADDRESS
MOVEM A,CMDBLK+.CMFLG ;SAVE RE-PARSE ADDRESS
SETZM CMDBLK+.CMINC ;INITIALIZE # OF CHARACTERS AFTER POINTER
MOVEI A,BUFSIZ*NCHPW ;GET # OF CHARACTERS IN BUFFER AREA
MOVEM A,CMDBLK+.CMCNT ;SAVE INITIAL # OF FREE CHARACTER POSITIONS
HRROI A,ATMBFR ;GET POINTER TO ATOM BUFFER
MOVEM A,CMDBLK+.CMABP ;SAVE POINTER TO LAST ATOM INPUT
MOVEI A,ATMSIZ*NCHPW ;GET # OF CHARACTERS IN ATOM BUFFER
MOVEM A,CMDBLK+.CMABC ;SAVE COUNT OF SPACE LEFT IN ATOM BUFFER
PARSE:
COMMAN: MOVEI A,CMDBLK ;GET ADDRESS OF COMMAND STATE BLOCK
MOVEI B,[FLDDB. (.CMINI)] ;GET FUNCTION DESCRIPTOR BLOCK
COMND ;INITIALIZE COMMAND SCANNER JSYS
PARSE1: MOVE A,[GJFBLK,,GJFBLK+1] ;SET UP TO CLEAR GTJFN BLOCK
MOVE P,[IOWD PDLN,PDL] ;GET STACK SET UP
SETZM GJFBLK ;CLEAR FIRST WORD OF BLOCK
BLT A,GJFBLK+GJFSIZ-1 ;CLEAR GTJFN BLOCK
MOVEI A,GJFBLK ;GET ADDRESS OF GTJFN BLOCK
MOVEM A,CMDBLK+.CMGJB ;STORE POINTER TO GTJFN BLOCK
MOVEI A,CMDBLK ;GET POINTER TO COMMAND STATE BLOCK
MOVEI B,[FLDDB. (.CMKEY,,CMDTAB)] ;GET FUNCTION BLOCK
COMND ;DO INITIAL PARSE
TXNN A,CM%NOP ;VALID COMMAND ENTERED ?
JRST PARSE5 ;YES, GO DISPATCH TO PROCESSING ROUTINE
CALL TSTCOL ;GO SEE IF CRLF NEEDED
TMSG <? MAKRAM: No such MAKRAM command as ">
MOVE A,CMDBLK+.CMABP ;GET POINTER TO ATOM BUFFER
PSOUT ;OUTPUT STRING ENTERED BY USER
TMSG <"
> ;OUTPUT END-OF-MESSAGE
JRST PARSE ;GO TRY TO GET A COMMAND AGAIN
PARSE5: HRRZ A,(B) ;GET DISPATCH ADDRESS
CALL (A) ;PERFORM REQUESTED FUNCTION
JRST PARSE ;GO PARSE NEXT COMMAND
SUBTTL ACTION ROUTINES
;
;
; DELIMITED-TRANSLATE (CHARACTER CODE)
; TRANSLATE (CHARACTER CODE)
;
DTRANS:
TDZA W1,W1 ;ASSUME NO TRANSLATE
TRANS:
MOVEI W1,TRNBIT ;GET TRANSLATE BIT
MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<CHARACTER CODE>)]
CALL SKNOIS ;GO DO NOISE WORDS
CALL GETCOD ;GO GET A NUMBER
RET ;FAILED
STKVAR <SVCODE>
MOVEM B,SVCODE
MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<TO>)]
CALL SKNOIS
MOVEI B,[FLDDB. (.CMKEY,,TRNTAB,<OCTAL CHARACTER CODE
OR>)]
TRANS1:
COMND
HRRZ B,(B) ;GET THE DISPATCH
TXNE A,CM%NOP ;THAT FAILED??
MOVEI B,GETCOD ;YES-- TRY FOR A CODE
CALL (B) ;CALL PROCESSOR
RET ;OOPS
CALL FINLIN ;GET CONFIRMATION
RET ;SORRY
IOR B,W1 ;SET TRANSLATE/DELIMITER BITS
MOVE A,SVCODE ;THE CODE
CALL SETFLD ;GO CHANGE RAM
RET ;AND DONE
;
; ACTION ROUTINES FOR "TRANSLATE" COMMAND
;
TRNTAB:
XWD TRNTBZ,TRNTBZ
XWD [ASCIZ/DELIMTER-CHARACTER/],DELIM
XWD [ASCIZ/NO-ACTION/],NOACT
XWD [ASCIZ/SLEW/],SLEW
XWD [ASCIZ/VFU-CHANNEL/],VFU
TRNTBZ==.-TRNTAB-1
;
DELIM:
MOVEI B,[FLDDB. (.CMNOI,,<TXTPTR <WITH>>)]
CALL SKNOIS ;NOISE
IORI W1,DELBIT ;SET DILIMITER BIT
MOVEI B,[FLDDB. (.CMKEY,,DLMTAB,<OCTAL CHARACTER CODE
OR>,<NO-ACTION>)]
POP P,(P) ;TRASH THE RETURN
CALLRET TRANS1 ;AND FINISH UP
;
DLMTAB:
XWD DLMTBZ,DLMTBZ
XWD [ASCIZ/NO-ACTION/],NOACT
XWD [ASCIZ/SLEW/],SLEW
XWD [ASCIZ/VFU-CHANNEL/],VFU
DLMTBZ==.-DLMTAB-1
;
NOACT:
SETZ B, ;NO ACTION IS ZERO
RETSKP ;GO AWAY HAPPY
;
SLEW:
CALL DECIN ;GET LINES
RET
PUSH P,B ;SAVE THAT MAN
MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<LINES>)]
CALL SKNOIS
POP P,B ;RESTORE THE LOST SOUL
CAIL B,0 ;SLEW -VE LINES??
CAILE B,^D15 ; BUT ONLY UP TO 15
JRST [ CALL TSTCOL
TMSG <? MAKRAM: Slew value out of range 0 to 15
>
RET]
IORI B,PAPBIT+1B<35-4> ;SAY A PAPER MOTION BIT
RETSKP ;AND DONE
;
VFU:
CALL DECIN
RET
SOSL B ;VALID CHANNEL?
CAIL B,^D12 ;STILL
JRST [ CALL TSTCOL
TMSG <? MAKRAM: Channel out of range 1 to 12
>
RET]
IORI B,PAPBIT ;TO THE VFU
RETSKP
;
; NUMBER-OF-DATA-BITS (IS)
;
NDBITS:
MOVEI B,[FLDDB. (.CMNOI,,<TXTPTR <IS>>)]
CALL SKNOIS
MOVEI B,[FLDDB. (.CMKEY,,NDBTAB)]
COMND ;GET THE TYPE-IN
TXNE A,CM%NOP ;FAILED?
JRST [ CALL TSTCOL
TMSG <? MAKRAM: Invalid number of data bits
>
RET]
CALL FINLIN ;GET CONFIRM
RET ;NOT REALLY
HRRE B,(B) ;GET THE VALUE
MOVEM B,EIGHTB ;SET THE FLAG
RET ;OK
;
NDBTAB:
XWD NDBTBZ,NDBTBZ
XWD [ASCIZ/7/],0
XWD [ASCIZ/8/],1
NDBTBZ==.-NDBTAB-1
;
; UPPER-CASE (OUTPUT ONLY)
;
UPPER: MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<OUTPUT ONLY>)]
CALL SKNOIS
MOVEI B,TRNBIT+"@" ;DO RAISE
;
LOOP: CALL FINLIN ;GET CONFIRM
RET ;NO CONFIRM
MOVEI A,"@"+40 ;DO ALL LOWER CASE LETTERS
STKVAR <SVA,SVB>
MOVEM A,SVA
MOVEM B,SVB ;STASH THEM
MOVEI W1,177-140 ;DO ALL CODES FROM 140 TO 176 (LEAVE DEL ALONE)
LOOP1: CALL SETFLD ;SET A FIELD
AOS A,SVA
AOS B,SVB
SOJG W1,LOOP1 ;DO ALL
RET ;DONE
;
; LOWER-CASE (OUTPUT)
;
LOWER: MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<OUTPUT>)]
CALL SKNOIS
MOVEI B,TRNBIT+"@"+40 ;CONVERT TO SELF
CALLRET LOOP ;GO TO IT
;
; ARROW-MODE (FOR CHARACTER CODE)
;
AROW: MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<FOR CHARACTER CODE>)]
CALL SKNOIS
CALL GETCOD ;GET CODE
RET
CALL FINLIN ;DO CONFIRM
RET
MOVEI A,0(B) ;THE CODE
MOVEI B,INTBIT+"^" ;ARROW MODE TRANSLATION
CALL SETFLD ;GO MODIFY RAM
RET ;AND DONE
;
; OUTPUT (TO RAM FILE)
;
OUTPUT: MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<TO RAM FILE>)]
CALL SKNOIS
MOVEI A,CMDBLK
MOVEI B,[FLDDB. (.CMOFI)]
COMND ;GET OUTPUT FILE
TXNN A,CM%NOP ;MAKE IT?
JRST OUT1 ;YES
CALL TSTCOL
TMSG <? MAKRAM: Illegal file spec
>
RET ;ERROR
OUT1: MOVE A,B ;SAVE JFN
MOVE B,[220000,,100000]
OPENF ;OPEN IT
JRST [ CALL TSTCOL
TMSG <? MAKRAM: Could not OPEN output file
>
RET] ;GIVE UP
MOVE B,[POINT ^D18,RAM]
MOVNI C,400 ;DO ALL OF RAM
SOUT ;WRITE IT
CLOSF ;CLOSE THE FILE
JFCL ;?
RET ;RETURN TO PARSER
; EXIT COMMAND
.EXIT: MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<TO MONITOR>)]
CALL SKNOIS ;DO NOISE
CALL FINLIN ;GET CONFIRM
RET ;NO CONFIRM
HALTF ;TO THE EXEC
JRST START ;IN CASE OF CONTINUE
; HELP COMMAND
.HELP:;
; HELP (WITH MAKRAM)
;
$HELP:
MOVEI B,[FLDDB. (.CMNOI,,<TXTPTR <WITH MAKRAM>>)]
CALL SKNOIS ;NOISE
CALL FINLIN ;CONFIRM
RET ;OOPS
MOVX A,GJ%SHT!GJ%OLD ;SET TO GET
hrroi b,[asciz /sys:makram.hlp/]
GTJFN ;OUR HELP FILE
JRST HLPERR ;OOPS
MOVX B,OF%RD+^D7B5 ;ASCII, READ
OPENF ;OPEN THE HELP FILE
JRST HLPERR ;OOPS
HRROI B,100K ;POINT TO SCRATCH
MOVX C,3*1000*5 ;THREE PAGES OF TEXT, MAX
MOVX D,0 ; OR ASCIZ
SIN ;READ HELP FILE
ERJMP .+1 ;IGNORE EOF, ERRORS
SETZ A, ;TERMINATE
IDPB A,B ;THE STRING OF INPUT
HRROI A,100K ;POINT TO TEXT
PSOUT ;SEND TO TTY
JRST PARSE ;GO DO NEXT COMMAND
;
HLPERR:
CALL TSTCOL ;GET TO COL 1
TMSG <? MAKRAM: Help file SYS:MAKRAM.HLP not available
>
JRST PARSE ;BACK AGAIN
SUBTTL UTILITY ROUTINES
SKNOIS: MOVEI A,CMDBLK
COMND ;DO NOISE WORDS
RET ;DONE
OCTIN: SKIPA B,[[FLDDB. (.CMNUM,,10)]]
DECIN: MOVEI B,[FLDDB. (.CMNUM,,^D10)]
MOVEI A,CMDBLK
COMND ;GET THE NUMBER
TXNN A,CM%NOP ;WORKED?
RETSKP ;YES
CALL TSTCOL
TMSG <? MAKRAM: Illegal number
>
RET ;RETURN BAD
SETFLD: EXCH A,B ;MOVE AROUND ARGS
IDIVI B,2 ;FIND PROPER WORD
XCT [ HRLM A,RAM(B)
HRRM A,RAM(B)](C)
ADDI B,^D128/2 ;POINT TO SECOND HALF
SKIPN EIGHTB ;8 DATA BITS?
XCT [ HRLM A,RAM(B) ;NO-- SET HIGH HALF OF RAM ALSO
HRRM A,RAM(B)](C) ; . .
RET ;DONE
GETCOD: CALL OCTIN ;GET A NUMBER
RET ;FAILED
CAIL B,0 ;-VE NO GOOD
CAIL B,^D256 ; OR ABOVE 256. WORDS
JRST GETCER ;SO SAY FOOEY
SKIPN EIGHTB ;8 BITS?
CAIGE B,^D128 ;NO-- MUST BE 7 BITS
RETSKP ;GOOD
GETCER:
CALL TSTCOL
TMSG <? MAKRAM: Character code out of range
>
RET
; INVALID END-OF-COMMAND
COMER1: CALL TSTCOL ;TEST COLUMN POSITION
TMSG <? MAKRAM: Garbage at end-of-command
> ;OUTPUT ERROR MESSAGE
RET ;RETURN TO WHENCE WE CAME ...
; SUBROUTINE TO TEST COLUMN POSITION AND OUTPUT CRLF IF NEEDED
TSTCOL: movei A,.priou ;get primary output designator
rfpos ;read file position
hrrz B,B ;keep just the column position
JUMPE B,R ;IF AT COLUMN 1 DO NOT OUTPUT CRLF
tmsg <
> ;no, output a crlf
RET ;RETURN
;ROUTINE TO DO END-OF-LINE PROCESSING
FINLIN: PUSH P,B ;SAVE DATUM
MOVEI B,[FLDDB. (.CMCFM)] ;CONFIRM
MOVEI A,CMDBLK ;ARG BLOCK
COMND ;FINISH PARSE
TXNE A,CM%NOP ;GOOD PARSE?
JRST [ POP P,B ;NO
CALLRET COMER1] ;GO BITCH
POP P,B ;RESTORE B
RETSKP ;GOOD
END <3,,ENTVEC>