Trailing-Edge
-
PDP-10 Archives
-
decus_20tap2_198111
-
decus/20-0071/eyes.mac
There are 2 other files named eyes.mac in the archive. Click here to see a list.
TITLE EYES -- A PROGRAM TO CONVERT AN ASCII FILE TO BRAILLE.
SIXBIT /EYES/
BEGIN: TTCALL 3,[ASCIZ/
SPECIFY FILE TO BE BRAILLED>/]
MOVE 1,[SIXBIT/DSK/] ;ASSUME INPUT DEVICE IS DISK.
MOVEM 1,INITCH+1 ;MOVE IT TO FILE INIT SPECIFICATIONS.
SETZM LOKBLK+1 ;CLEAR WORD 2 OF LOOKUP BLOCK.
SETZM LOKBLK+2 ;CLEAR WORD 3 OF LOOKUP BLOCK.
SETZM LOKBLK+3 ;CLEAR WORD 4 OF LOOKUP BLOCK.
SETZB 2,3 ;CLEAR AC'S FOR PPN.
SETZB 0,10 ;CLEAR FILENAME AND TTY INPUT AC'S.
MOVSI 1,-7 ;MAXIMUM OF 6 CHARS IN FILENAME.
MOVE 11,FILPTR ;MOVE FILENAME POINTER TO FAST MEMORY.
TTCALL 4,10 ;INPUT A CHAR TO AC 10, LINE MODE.
JRST .+2 ;ON FIRST CHAR, SKIP.
FILEIN: TTCALL 0,10 ;INPUT ANOTHER CHAR TO AC 10.
CAIN 10,":" ;IS IT A ":"?
JRST GETDEV ;IF SO, JUMP TO GET DEVICE.
CAIN 10,"." ;IS IT A "."?
JRST GETEXT ;IF SO, JUMP TO GET EXTENSION.
CAIN 10,"[" ;IS IT A "["?
JRST PPN ;IF SO, JUMP TO GET PPN.
CAIN 10,015 ;IS IT A CR?
JRST READY ;IF SO, JUMP TO INPUT FILE.
AOBJP 1,FILEIN ;IF MORE THAN 6 CHARS, IGNORE REST.
CAIG 10,137 ;IS THE CHAR LOWER CASE?
ADDI 10,40 ;IF NOT, CONVERT FOR SIXBIT.
IDPB 10,11 ;STORE THE CHAR IN AC 0 IN SIXBIT.
JRST FILEIN ;GET NEXT CHAR.
GETDEV: MOVEM 0,INITCH+1 ;MOVE DEVICE SPECIFIED FOR FILE INIT
JRST BEGIN+7 ;JUMP TO GET FILENAME.
GETEXT: MOVSI 1,-4 ;MAXIMUM OF 3 CHARS IN EXTENSION.
MOVE 11,EXTPTR ;MOVE EXTENSION POINTER TO FAST MEMORY.
TTCALL 0,10 ;INPUT A CHAR OF EXTENSION TO AC 10.
CAIN 10,"[" ;IS IT A "["?
JRST PPN ;IF SO, JUMP TO GET PPN.
CAIN 10,015 ;IS IT A CR?
JRST READY ;IF SO, JUMP TO INPUT FILE
AOBJP 1,GETEXT+2 ;IF MORE THAN 3 CHARS, IGNORE REST.
CAIG 10,137 ;IS THE CHAR LOWER CASE?
ADDI 10,40 ;IF SO, MAKE IT UPPER CASE.
IDPB 10,11 ;STORE THE CHAR IN AC 0.
JRST GETEXT+2 ;GET NEXT CHAR.
PPN: MOVSI 1,-7 ;MAXIMUM OF 6 DIGITS IN PROJECT NUMBER.
TTCALL 0,10 ;INPUT A DIGIT TO AC 10.
CAIN 10,"," ;IS IT A ","?
JRST PN ;IF SO, JUMP TO GET PROGRAMMER NUMBER.
CAIN 10,"]" ;IS IT A "]"?
JRST PPN+1 ;IF SO, IGNORE IT.
CAIN 10,015 ;IS IT A CR?
JRST READY-1 ;IF SO, JUMP TO STORE PROJECT NUMBER.
AOBJP 1,PPN+1 ;IF MORE THAN 6 DIGITS, IGNORE REST.
ANDI 10,7 ;SAVE LAST 3 BITS.
LSH 2,3 ;MAKE ROOM IN AC 2,
IOR 2,10 ;AND STORE OCTAL DIGIT.
JRST PPN+1 ;GET NEXT DIGIT.
PN: MOVSI 1,-7 ;MAXIMUM OF 6 DIGITS IN PROG. NUMBER.
TTCALL 0,10 ;INPUT A DIGIT TO AC 10.
CAIN 10,"]" ;IS IT A "]"?
JRST PN+1 ;IF SO, IGNORE IT.
CAIN 10,015 ;IS IT A CR?
JRST READY-2 ;IF SO, JUMP TO STORE PPN AND DO INPUT.
AOBJP 1,PN+1 ;IF MORE THAN 6 DIGITS, IGNORE REST.
ANDI 10,7 ;SAVE LAST 3 BITS.
LSH 3,3 ;MAKE ROOM IN AC 3,
IOR 3,10 ;AND STORE OCTAL DIGIT.
JRST PN+1 ;GET NEXT DIGIT.
HRRM 3,LOKBLK+3 ;STORE PROGRAMMER NUMBER,
HRLM 2,LOKBLK+3 ;AND PROJECT NUMBER IN LOOKUP BLOCK.
PAGE
READY: TTCALL 11,0 ;CLEAR TTY INPUT BUFFER.
MOVEM 0,LOKBLK ;MOVE FILENAME TO LOOKUP BLOCK.
INITCH: INIT 0,17 ;INITIALIZE CHANNEL, DUMP MODE, INPUT.
0 ;DEVICE DEPENDS ON USER.
0 ;NO BUFFERING.
JRST .+2 ;ON ERROR, SKIP.
JRST .+3 ;OK, CONTINUE.
TTCALL 3,[ASCIZ/
?DEVICE DOES NOT EXIST.
/]
JRST BEGIN ;TRY AGAIN.
LOOKUP 0,LOKBLK ;PERFORM FILE LOOKUP.
JRST .+2 ;ON ERROR, SKIP.
JRST .+3 ;OK, CONTINUE.
TTCALL 3,[ASCIZ/
?FILE NOT FOUND OR PROTECTION FAILURE.
/]
JRST BEGIN ;TRY AGAIN.
SETZM TYPFLE ;SET FILE TYPE FLAG TO NON-DATA TYPE.
TTCALL 11,0 ;CLEAR TTY INPUT BUFFER.
TTCALL 3,[ASCIZ/
DATA FILE?(Y,N)>/]
TTCALL 4,10 ;INPUT A CHAR TO AC 10.
TTCALL 11,0 ;CLEAR TTY INPUT BUFFER.
CAIN 10,"Y" ;IS A DATA FILE SPECIFIED?
SETOM TYPFLE ;IF SO, SET FLAG SO BLANKS NOT IGNORED
INIT 1,0 ;INITIALIZE CHANNEL, ASCII, OUTPUT.
;[DECUS] CHANGE LPT TO DSK
SIXBIT /DSK/ ;DEVICE IS LPT.
XWD OBUF,0 ;SPECIFY OUTPUT RING HEADER BLOCK.
WAIT 1,0 ;ON ERROR, WAIT FOR INACTIVE DEVICE.
JSP 13,BLOKIN ;GET A BLOCK OF DATA.
JSP 16,BLINE ;BLANK OUT THE BRAILLE LINE.
MOVEI 17,STACK-1 ;SET UP STACK POINTER.
MOVEI 15,"." ;AC 15 WILL HOLD ASCII CODE FOR ".".
INCHAR: JSP 16,GETCHR ;GET A CHAR FROM FILE, PUT IN AC 10.
CAIN 10,015 ;IS IT A CR?
JRST INCHAR ;IF SO, IGNORE IT.
CAIE 10,012 ;IS IT A LF?
JRST .+3 ;IF NOT, CHECK NEXT CHAR.
JSP 7,SETUP ;IF SO, DONE WITH LINE.
JRST INCHAR ;THEN GET ANOTHER CHARACTER.
CAIN 10,011 ;IS IT A TAB?
JRST INCHAR ;IF SO, IGNORE IT.
CAIE 10,040 ;IS IT A BLANK?
JRST .+5 ;IF NOT, JUMP AHEAD.
SKIPN TYPFLE ;IF A BLANK AND A DATA FILE, SKIP.
JRST INCHAR ;IF ANOTHER TYPE OF FILE, IGNORE BLANK.
JSP 13,PUSHDN ;IF A DATA FILE, STACK ALL BLANKS.
JRST INCHAR ;GET ANOTHER CHARACTER.
CAIG 10,037 ;IS IT ANOTHER CONTROL CHARACTER?
JRST CTLCH ;IF SO, PROCESS IT.
JSP 13,PUSHDN ;IF NOT, STACK THE PRINTABLE CHARACTER.
JRST INCHAR ;GET ANOTHER CHARACTER.
PAGE
;A SUBROUTINE TO PROCESS CONTROL CHARACTERS EITHER BY TERMINATING THE
;LINE AND ALLOWING PAPER MOVEMENT OR BY SETTING UP THE CHARACTER TO
;BE PRINTED IN ARROW FORMAT.
CTLCH: CAIN 10,014 ;IS IT A FF?
JRST FF ;IF SO, JUMP TO PROCESS IT.
CAIN 10,000 ;IS IT NULL?
JRST INCHAR ;IF SO, IGNORE IT.
CAIN 10,013 ;IS IT A VT?
JRST VT ;IF SO, JUMP TO PROCESS IT.
CAIE 10,033 ;IS IT ESC?
JRST .+4 ;IF NOT, JUMP AHEAD.
MOVEI 10,"$" ;IF SO, ECHO AS A "$".
JSP 13,PUSHDN ;STACK THE "$".
JRST INCHAR ;GET ANOTHER CHARACTER.
MOVEM 10,SAVE ;ECHO ALL OTHERS IN ARROW FORMAT.
MOVEI 10,"^" ;MOVE "^" TO AC 10.
JSP 13,PUSHDN ;STACK THE "^".
MOVE 10,SAVE ;RESTORE THE CONTROL CHARACTER TO AC 10.
ADDI 10,100 ;CONVERT.
JSP 13,PUSHDN ;STACK THE PRINTABLE CHARACTER.
JRST INCHAR ;GET ANOTHER CHARACTER.
PAGE
;A SUBROUTINE WHICH WILL SET UP THE APPROPRIATE BRAILLE CELL(IN REVERSE)
;BY PLACING DOTS CORRECTLY IN THE BRAILLE LINE.
CELL: MOVSI 11,-2 ;2 COLUMNS IN 1 CELL.
LOOP: IBP 14 ;BYTE POINTER POINTS TO CORRECT COLUMN.
MOVSI 2,-3 ;3 ROWS IN 1 CELL.
LOOP1: CAIGE 12,0 ;IS A DOT PRESENT IN THIS POSITION?
DPB 15,14 ;IF SO, PUT THE DOT IN THE LINE.
LSH 12,1 ;SHIFT BRAILLE CODE FOR NEXT POSITION.
ADDI 14,30 ;ADD 30 TO ADDRESS POINTER FOR NEXT LINE.
AOBJN 2,LOOP1 ;IF NOT DONE WITH COLUMN, GET NEXT ROW.
SUBI 14,110 ;SET ADDRESS POINTER BACK TO FIRST ROW.
AOBJN 11,LOOP ;IF NOT DONE WITH CELL, GET NEXT COLUMN.
IBP 14 ;INCREMENT BYTE POINTER FOR SPACING.
JRSTF 0(16) ;RETURN.
PAGE
;A SUBROUTINE TO INPUT A 128 (DECIMAL) WORD BLOCK FROM DISK.
BLOKIN: MOVEI 3,1200 ;640 (DECIMAL) BYTES IN BLOCK.
MOVEM 3,COUNT ;SAVE IT.
MOVE 3,PIOWD ;MOVE PERMANENT IOWD TO AC 3.
MOVEM 3,TIOWD ;SAVE IT.
INPUT 0,TIOWD ;INPUT A BLOCK OF DATA.
STATZ 0,300000 ;CHECK FOR ERROR.
JRST .+2 ;ON ERROR, SKIP.
JRST .+3 ;OK, CONTINUE.
TTCALL 3,[ASCIZ/
?DEVICE OR DATA ERROR.
/]
CALLI 0,12 ;EXIT ON ERROR.
STATZ 0,020000 ;CHECK FOR END-OF-FILE.
JRST EOF ;AT EOF, JUMP TO FINISH UP.
MOVE 3,DPOINT ;MOVE DATA POINTER TO FAST MEMORY.
MOVEM 3,TPTR ;MOVE IT TO TEMPORARY POINTER.
JRSTF 0(13) ;RETURN.
PAGE
GETCHR: ILDB 10,TPTR ;LOAD A BYTE FROM INPUT FILE TO AC 10.
SOSG COUNT ;NEED MORE DATA?
JSP 13,BLOKIN ;IF SO, GET ANOTHER BLOCK.
JRSTF 0(16) ;RETURN.
PAGE
;THE FOLLOWING SET OF SUBROUTINES PROCESS SPECIAL CONDITIONS AND CERTAIN
;CONTROL CHARACTERS.
;
;
;A SUBROUTINE TO TERMINATE A LINE AND EJECT A PAGE
FF: TLNE 17,777777 ;IS STACK EMPTY?
JSP 7,SETUP+4 ;IF NOT, END OF LINE.
MOVEI 14,014 ;MOVE A FORM FEED CHARACTER TO AC 14,
JSP 13,PUT ;AND PUT IT IN OUTPUT LINE.
JRST INCHAR ;GET ANOTHER CHARACTER.
;
;A SUBROUTINE TO TERMINATE A LINE AND VERTICAL TAB THE PAGE.
VT: TLNE 17,777777 ;IS STACK EMPTY?
JSP 7,SETUP+4 ;IF NOT, END OF LINE.
MOVEI 14,013 ;MOVE A VERTICAL TAB CHAR TO AC 14,
JSP 13,PUT ;AND PUT IT IN OUTPUT LINE.
JRST INCHAR ;GET ANOTHER CHARACTER.
;A SUBROUTINE TO SKIP 1 BRAILLE LINE (3 PRINTER LINES).
SKPLIN: MOVSI 12,-3 ;3 PRINTER LINES TO BE SKIPPED.
MOVEI 14,015 ;PUT A CR IN AC 14.
JSP 13,PUT ;PUT IN OUTPUT LINE.
MOVEI 14,012 ;PUT A LF IN AC 14.
JSP 13,PUT ;PUT IN OUTPUT LINE.
AOBJN 12,SKPLIN+1 ;3 TIMES.
JRSTF 0(16) ;RETURN.
;
;A SUBROUTINE TO BLANK OUT 1 BRAILLE LINE (3 PRINTER LINES).
BLINE: MOVE 2,BLANK ;MOVE BLANKS TO AC 2.
MOVEM 2,LINE1 ;MOVE IT TO FIRST LINE LOCATION.
MOVEI 2,LINE1+1 ;PUT ADDRESS OF 2-ND LOCATION IN AC 2.
HRLI 2,LINE1 ;PUT ADDRESS OF 1-ST LOCATION IN AC 2.
BLT 2,LINE3+27 ;BLANK OUT BRAILLE LINE.
JRSTF 0(16) ;RETURN.
PAGE
;A SUBROUTINE TO REMOVE CHARACTERS FROM THE STACK AND SET UP THE BRAILLE
;LINE.
SETUP: TLNE 17,777777 ;IS STACK EMPTY?
JRST .+3 ;IF NOT, JUMP AHEAD TO CONVERT LINE.
JSP 16,SKPLIN ;IF SO, THEN JUMP TO SKIP BRAILLE LINE.
JRST INCHAR ;GET ANOTHER CHARACTER.
HLRZ 3,17 ;PUT NUMBER OF CHARS IN STACK IN AC 3
IMULI 3,3 ;3 COLUMNS IN CELL (ONE BLANK).
IDIVI 3,5 ;NUMBER OF WORDS FROM RIGHT END OF LINE
MOVE 2,LPTR ;MOVE LINE POINTER TO AC 2 TO MODIFY IT.
SUB 2,3 ;MODIFY THE ADDRESS FOR FIRST CELL.
MOVEM 2,14 ;PUT IT BACK WITH NEW ADDRESS.
MOVEI 2,5 ;MOVE 5 TO AC 2.
SUB 2,4 ;SUBTRACT NUMBER OF BYTES IN WORD (REM)
IMULI 2,7 ;MULTIPLY BY 7 GET NUMBER OF BITS.
MOVEI 5,44 ;MOVE 44 TO AC 5.
SUB 5,2 ;GET CORRECT BYTE POSITION P.
DPB 5,[POINT 6,14,5] ;CHANGE BYTE POSITION P IN POINTER.
POPUP: TLNE 17,777777 ;IS STACK EMPTY?
JRST .+2 ;IF NOT, SKIP.
JRST DONE ;IF SO, JUMP TO OUTPUT BRAILLE LINE.
POP 17,10 ;POP A CHARACTER INTO AC 10.
CAIL 10,141 ;IS IT LOWER CASE?
SUBI 10,40 ;IF SO, CONVERT TO UPPER CASE.
SUBI 10,40 ;SUBTRACT 40 FOR INDEXING.
MOVE 12,DOTCOD(10) ;MOVE THE CORRECT BRAILLE CODE TO AC 12.
JSP 16,CELL ;JUMP TO SET UP BRAILLE CELL
JRST POPUP ;GET NEXT CHARACTER FROM STACK.
DONE: JSP 1,PUTLIN ;WHEN STACK EMPTY, JUMP TO OUTPUT LINE.
JSP 16,SKPLIN ;JUMP TO SKIP 1 BRAILLE LINE.
JRSTF 0(7) ;RETURN
PAGE
;A SUBROUTINE TO STACK INPUTTED CHARACTERS.
PUSHDN: PUSH 17,10 ;STACK THE INPUTTED CHARACTER.
HLRZ 16,17 ;PUT STACK COUNT IN AC 16.
CAIE 16,50 ;IS STACK FULL?
JRSTF 0(13) ;IF NOT, RETURN.
JSP 7,SETUP+4 ;IF SO, END OF LINE.
JRST INCHAR ;GET ANOTHER CHARACTER.
PAGE
;A SUBROUTINE TO PUT 1 BRAILLE LINE (3 PRINTER LINES) IN THE OUTPUT
;BUFFER.
PUTLIN: MOVE 11,OUTPTR ;MOVE OUTPUT POINTER TO FAST MEMORY.
MOVSI 12,-3 ;3 LINES IN 1 BRAILLE LINE.
MOVE 6,LLIMIT ;MOVE NUMBER OF CHARS IN LINE TO AC 6.
ILDB 14,11 ;GET A CHAR FROM LINE.
JSP 13,PUT ;JUMP TO PUT IN BUFFER.
SOJG 6,.-2 ;DONE WITH A LINE?
MOVEI 14,015 ;TERMINATE LINE WITH A CR.
JSP 13,PUT ;PUT IN OUTPUT BUFFER.
MOVEI 14,012 ;AND A LF.
JSP 13,PUT ;PUT IN OUTPUT BUFFER.
AOBJN 12,PUTLIN+2 ;IF NOT DONE, GET NEXT LINE.
JSP 16,BLINE ;IF DONE, BLANK BRAILLE LINE.
JRSTF 0(1) ;RETURN
PUT: SOSG OBUF+2 ;IS BUFFER FULL?
JRST .+3 ;IF SO, OR FIRST TIME, CONTINUE.
IDPB 14,OBUF+1 ;PUT CHAR IN OUTPUT BUFFER,
JRSTF 0(13) ;AND RETURN.
OUT 1, ;EMPTY BUFFER AND SET UP HEADER.
JRST PUT+2 ;RESTART FILLING BUFFER.
TTCALL 3,[ASCIZ/
OUTPUT ERROR
/]
CALLI 0,12 ;EXIT ON ERROR.
PAGE
;END-OF-FILE ROUTINE.
EOF: CLOSE 0,0 ;CLOSE INPUT CHANNEL,
CLOSE 1,0 ;AND OUTPUT CHANNEL.
TTCALL 11,0 ;CLEAR TTY INPUT BUFFER.
TTCALL 3,[ASCIZ/
CONVERSION COMPLETE.
MORE?(Y,N)/]
TTCALL 4,10 ;WAIT FOR REPLY.
TTCALL 11,0 ;CLEAR TTY INPUT BUFFER.
CAIN 10,"Y" ;MORE CONVERSION?
JRST BEGIN ;IF SO, JUMP TO BEGIN.
CALLI 0,12 ;IF NOT, EXIT.
PAGE
;THIS BLOCK CONTAINS THE DOT CODE FOR THE BRAILLE CELL FOR EACH ASCII
;CHARACTER.
DOTCOD: 000000000000
360000000000 ;!
300000000000 ;"
710000000000 ;#
650000000000 ;$
760000000000 ;%
570000000000 ;&
100000000000 ;'
160000000000 ;(
610000000000 ;)
140000000000 ;*
510000000000 ;+
010000000000 ;,
110000000000 ;-
500000000000 ;.
410000000000 ;/
310000000000 ;0
020000000000 ;1
030000000000 ;2
220000000000 ;3
320000000000 ;4
120000000000 ;5
230000000000 ;6
330000000000 ;7
130000000000 ;8
210000000000 ;9
700000000000 ;:
600000000000 ;;
520000000000 ;<
340000000000 ;=
400000000000 ;>
770000000000 ;?
200000000000 ;@
040000000000 ;A
060000000000 ;B
440000000000 ;C
640000000000 ;D
240000000000 ;E
460000000000 ;F
660000000000 ;G
260000000000 ;H
420000000000 ;I
620000000000 ;J
050000000000 ;K
070000000000 ;L
450000000000 ;M
650000000000 ;N
250000000000 ;O
470000000000 ;P
670000000000 ;Q
270000000000 ;R
430000000000 ;S
630000000000 ;T
150000000000 ;U
170000000000 ;V
720000000000 ;W
550000000000 ;X
750000000000 ;Y
350000000000 ;Z
370000000000 ;[
140000000000 ;|
730000000000 ;]
740000000000 ;^
530000000000 ;_
100000000000 ;'
PAGE
;DATA SECTION
;
PIOWD: IOWD 200,DATBLK ;PERMANENT IOWD.
TIOWD: 0 ;TEMPORARY IOWD.
0 ;TERMINATES COMMAND LIST.
LINE1: BLOCK 30 ;FIRST LINE OF BRAILLE LINE.
LINE2: BLOCK 30 ;SECOND LINE OF BRAILLE LINE.
LINE3: BLOCK 30 ;THIRD LINE OF BRAILLE LINE.
DATBLK: BLOCK 200 ;HOLDS A DATA BLOCK FROM DISK
DPOINT: POINT 7,DATBLK ;BYTE POINTER TO INPUT ASCII CHARS.
EXTPTR: POINT 6,LOKBLK+1 ;BYTE POINTER TO STORE EXTENSION.
FILPTR: POINT 6,0 ;BYTE POINTER TO STORE FILENAME.
OUTPTR: POINT 7,LINE1 ;BYTE POINTER TO GET CHARS FOR OUTPUT.
LPTR: POINT 7,LINE1+27 ;BYTE POINTER FOR BRAILLE LINE.
TPTR: 0 ;TEMPORARY BYTE POINTER.
STACK: BLOCK 50 ;STACK FOR STORING INPUT CHARACTERS.
TYPFLE: 0 ;FILE TYPE FLAG.
LOKBLK: BLOCK 4 ;FILE LOOKUP BLOCK.
OBUF: BLOCK 3 ;OUTPUT FILE BUFFER RING HEADER BLOCK.
COUNT: 0 ;HOLDS BYTE COUNT.
SAVE: 0 ;SAVE WORD.
LLIMIT: 170 ;120 (DECIMAL) CHARS IN 1 LINE.
BLANK: ASCII / / ;FULLWORD OF BLANKS.
END BEGIN