Trailing-Edge
-
PDP-10 Archives
-
decuslib10-02
-
43,50247/ardmac.mac
There are 2 other files named ardmac.mac in the archive. Click here to see a list.
TITLE ARDMAC
INTERNAL CRTOFF,CRTON,CRTLTR,CRTSTR,CRTSCP,CRTWIP
INTERNAL CRTXYZ,CRTHLT
MSTKNT: 0
;THE MONITOR MUST NOT INSERT CHARACTERS INTO THE STRING
;WHICH IS OUTPUT BY THIS PROGRAM. UNFORTUNATELY, STANDARD
;DEC MONITORS INSERT A CARRIAGE RETURN IF ONE HAS NOT BEEN
;OUTPUT IN LAST 72 CHARACTERS (FOR TTY). THIS PROGRAM CAN
;INSERT CARRIAGE RETURNS WHERE NECESSARY IF MSTKNT IS
;GIVEN THE VALUE 1. NO SUCH INSERTION IS DONE IF MSTKNT
;IS GIVEN THE VALUE 0. THE LATTER OPTION MUST NOT BE
;USED UNLESS THE MONITOR RECOGNIZES GRAPHIC OUTPUT (HERE
;DESIGNATED BY THE INIT FOLLOWING ADDRESS 'GRAFIC' BELOW)
;AS NOT REQUIRING CARRIAGE RETURN INSERTION. THE COUNTER
;CALLED KOUNT IS USED TO CHECK THE NUMBER OF CHARACTERS
;WHICH CAN STILL BE GIVEN BEFORE THE PROGRAM MUST SEND
;A CARRIAGE RETURN. AFTER GIVING A CARRIAGE RETURN, THIS
;COUNT IS RESET TO 68 (OCTAL 104, 4 LESS THAN THE 72
;CHARACTER LIMIT OF THE TELETYPE). THE VALUE 104 CAN BE
;CHANGED TO MATCH THE WIDTHS OF OTHER STANDARD OUTPUTS.
;THIS LIMIT MUST BE 4 LESS THAN THE MAXIMUM IN ORDER TO
;ALLOW A TEST FOR THE COUNT BEING POSITIVE TO BE SUFFICIENT
;TO DETERMINE IF 5 CHARACTERS CAN STILL BE GIVEN (THE
;MAXIMUM NECESSARY FOR A SINGLE COORDINATE STRING).
;
;FORTRAN CALLABLE ROUTINES FOR ARDS TERMINAL GRAPHICS
;
;FOLLOWING SECTION INSTRUCTS MONITOR THAT ARDS
;TERMINAL IS A GRAPHIC DEVICE (INPUT IS NOT BE BE ECHOED,
;NO TRANSLATION IS TO BE DONE ON OUTPUT).
GRAFIC: 0
MOVNI 0, 1
TTCALL 6, 0
TLO 0, 20
TTCALL 7, 0
INIT 17, 1700
SIXBIT /TTY/
0
HALT
SETOM ARDTYP ;SET SWITCH TO SHOW TYPE
JRA 16, (16)
ARDTYP: 0
;
;FOLLOWING SECTION INSTRUCTS MONITOR THAT ARDS TERMINAL
;IS TO BE TREATED AS A TELETYPE (INPUT IS TO BE ECHOED,
;LOWER CASE OUTPUT CHARACTERS ARE TO BE TRANSLATED TO UPPER).
TTY: 0
MOVNI 0, 1
TTCALL 6, 0
TLZ 0, 20
TTCALL 7, 0
INIT 17, 0
SIXBIT /TTY/
0
HALT
SETZM ARDTYP ;SET SWITCH TO SHOW TYPE
JRA 16, (16)
;
;ENTRY CRTOFF(NEWX,NEWY)
;POSITIONS BEAM FOR START OF A LINE
;DOES NOT CAUSE PLOTTING
;NEWX = HORIZONTAL COORDINATE
;NEWY = VERITCAL COORDINATE
;(DIMENSION SYSTEM IS 1 TO 1023)
;POINT 0,0 IS LOWER LEFT CORNER
CRTOFF: 0
MOVEM 0, SAVE0 ;SAVE AC 0
MOVE 0, @(16) ;TEST IF BEAM ALREADY AT POINT
CAME 0, LASTX
JRST GOON ;IF NOT, PROCESS NEW POINT
MOVE 0, @1(16)
CAME 0, LASTY
JRST GOON ;IF NOT, PROCESS NEW POINT
MOVE 0, SAVE0 ;OTHERWISE, RESTORE AC 0 AND RETURN
JRA 16, 2(16)
GOON: MOVEM 1, SAVE1 ;SAVE AC 1
JRST .+2
CHECK: 0
SKIPE MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
SKIPLE 0, KOUNT ;DOES MONITOR WANT LINE FEED
JRST GOOD ;IF NOT, PROCESS DIRECTLY
JRST .+2
PATCH: 0
TTCALL 1, [15] ;SUPPLY LINE FEED
SETZM 0, MODE ;ASSURE COMMAND OUTPUT BEFORE COORDS
MOVEI 0, 104 ;RESET COUNT TO 4 LESS THAN LIMIT
MOVEM 0, KOUNT
GOOD: MOVEI 1, 35 ;AC 1 CONTAINS COMMAND MODE WHICH NEED
;NOT BE REPEATED IF SAME AS LAST MODE
SKIPN ARDTYP ;TEST IS ARDS IS IN GRAPHIC MODE,
JSA 16, GRAFIC ;IF NOT, HAVE IT SET
MOVE 0, @(16) ;GET ABSOLUTE X COORDINATE
MOVEM 0, LASTX ;STORE THIS IN LASTX
JSA 16, ARDCRD ;SEND COORDINATE TO TERMINAL
MOVE 0, @1(16)
MOVEM 0, LASTY
JSA 16, ARDCRD
MOVE 0, SAVE0
MOVE 1, SAVE1
JRA 16, 2(16)
;CHARACTERS TO BE TRANSMITTED.
KOUNT: 0 ;INITIALIZE KOUNT AT 0 SO
;OVERLAY WILL SEND CARRIAGE
;RETURN, RATHER THAN LET TOO
;MANY CHARACTERS THROUGH
SAVE0: 0
SAVE1: 0
LASTX: 777777777777
LASTY: 777777777777
MODE: 0
;
;ENTRY CRTON (NEWX,NEWY)
;PLOTS LINE FROM OLD BEAM POSITION TO NEW
;NEWX = HORIZONTAL COORDINATE
;NEWY = VERTICAL COORDINATE
;(DIMENSION SYSTEM IS 1 TO 1023 WITH 0, 0
;IN LOWER LEFT CORNER)
CRTON: 0
MOVEM 0, SAVE0 ;SAVE AC 0
MOVEM 1, SAVE1 ;SAVE AC 1
SKIPE MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
SKIPLE 0, KOUNT ;TEST IF MONITOR WANTS LINE FEED
JRST SOSO
JSA 16, PATCH ;IF DOES, GIVE IT, RESET POSITION
ARG 0, LASTX
ARG 0, LASTY
SOSO: MOVE 0, @(16) ;GET X COORDINATE
SUB 0, LASTX ;CONVERT TO RELATIVE VECTOR
CAMG 0, [37] ;TEST IF X MOTION IS SHORT
CAMGE 0, [-37]
JRST LONG ;IF NOT, PROCESS AS LONG VECTOR
MOVE 1, @1(16) ;OTHERWISE, GET Y COORDINATE
SUB 1, LASTY ;CONVERT TO RELATIVE VECTOR
CAMG 1, [37] ;TEST IF Y MOTION IS ALSO SHORT
CAMGE 1, [-37]
JUMPA 1, LONG ;IF NOT, PROCESS AS LONG VECTOR
MOVEI 1, 37 ;OTHERWISE, USE SHORT VECTOR MODE
JRST .+2
LONG: MOVEI 1, 36 ;SET SWITCH FOR LONG VECTOR MODE
JSA 16, ARDVCT ;SEND X COMPONENT OF VECTOR
MOVE 0, @(16) ;GET X COORD AND STORE IN LASTX
MOVEM 0, LASTX
MOVE 0, @1(16) ;GET Y COORDINATE
SUB 0, LASTY ;CONVERT TO RELATIVE VECTOR
JSA 16, ARDVCT
MOVE 0, @1(16)
MOVEM 0, LASTY
MOVE 0, SAVE0
MOVE 1, SAVE1
JRA 16, 2(16)
;
;INTERNAL ENTRY ARDCRD
;ROUTINE TO TRANSMIT COORDINATES FOR ARDS SCOPE PLOTTING
;COORDINATE ARGUMENT IS INPUT IN AC 0
;MODE ARGUMET IS INPUT IN AC 1
ARDCRD: 0
SUBI 0, 1000
JRST .+2
ARDVCT: 0
CAMN 1, MODE
JRST NONEED
SKIPE MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
SOS 0, KOUNT
TTCALL 1, 1
MOVEM 1, MODE
NONEED: JUMPGE 0, POS
MOVMM 0, SAVE
MOVE 0, SAVE
LSH 0, 1
AOJA 0, ALL
POS: MOVEM 0, SAVE
LSH 0, 1
ALL: IORI 0, 100
SKIPE MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
SOS 0, KOUNT
TTCALL 1, 0
CAIN 1, 37
JRA 16, (16)
MOVE 0, SAVE
LSH 0, -5
IORI 0, 100
SKIPE MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
SOS 0, KOUNT
TTCALL 1, 0
JRA 16, (16)
SAVE: 0
;
;ENTRY CRTSCP(KONTRL)
;ROUTINE TO SELECT WHETHER OUTPUT IS STORED ON SCOPE.
;KONTRL = 0, ENABLE WRITE-THROUGH (MOMENTARY DISPLAY ONLY)
; = 1, CAUSE ALL OUTPUT TO BE STORED ON TUBE
CRTSTR: 0
MOVEM 0, SAVE0
MOVE 0, @(16)
ANDI 0, 1
LSH 0, 5
XORI 0, 140
MOVEM 0, RITHRU
JRST 0, SETSCP
;
;ENTRY CRTSCP(KONTRL)
;KONTRL IS BIT CODED MASK SELECTING SCOPES TO SHOW OUTPUT.
;KONTRL = 1 SELECTS SCOPE 1.
;KONTRL = 2 SELECTS SCOPE 2.
;KONTRL = 3 SELECTS BOTH SCOPES 1 AND 2.
CRTSCP: 0
MOVEM 0, SAVE0 ;SAVE AC 0
MOVE 0, @(16) ;GET SCOPE DESIGNATION
ANDI 0, 37 ;CHOP OFF ANY EXTRA BITS
XORI 0, 37 ;REVERSE BITS TO FIT ARDS
MOVEM 0, SCOPES ;NOTATION AND STORE
SETSCP: SKIPN ARDTYP ;TEST IS ARDS IS IN GRAPHIC MODE,
JSA 16, GRAFIC ;IF NOT, HAVE IT SET
SKIPE MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
SKIPLE 0, KOUNT
JRST GIVEIT
TTCALL 1, [15]
SETZM 0, MODE
MOVEI 0, 104
MOVEM 0, KOUNT
GIVEIT: MOVE 0, MODE
CAIN 0, 35
JRST GIVES
TTCALL 1, [35]
SKIPE MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
SOS 0, KOUNT
GIVES: SETZM 0, MODE
TTCALL 1, [46]
MOVE 0, SCOPES
IOR 0, RITHRU
TTCALL 1, 0
MOVE 0, SAVE0
SKIPN MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
JRA 16, 1(16)
SOS KOUNT
SOS KOUNT
JRA 16, 1(16)
SCOPES: 0
RITHRU: 100
;SUBROUTINE CRTLTR(STRING,IFIRST,IFINAL,IX,IY)
;STRING = ASCII CHARACTER STRING
;IFIRST = COUNT OF FIRST LETTER TO PLOT
;IFINAL = COUNT OF FINAL LETTER TO PLOT
;IX = HORIZONTAL COORDINATE OF LETTERING
;IY = VERTICAL COORDINATE OF LETTERING
CRTLTR: 0
MOVEM 0, SAVE0 ;SAVE AC 0
MOVEM 1, SAVE1 ;SAVE AC 1
MOVE 0, @2(16) ;GET UPPER CHARACTER COUNT
SUB 0, @1(16) ;SUBTRACT LOWER CHARACTER COUNT
JUMPGE 0, .+2 ;TEST IF UPPER COUNT LESS THAN LOWER
JRA 16, 5(16) ;RETURN IF NO CHARACTERS
ADDI 0, 2 ;ALLOW END AND CONTROL CHARACTERS
MOVEM 0, LTRCNT ;SAVE THE CHARACTER COUNT
SKIPN MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
JRST LNOKNT ;IF NOT, DON'T CHANGE COUNT
CAIL 0, 104 ;TEST IF TOO MANY CHARACTERS FOR LINE
JRA 16, 5(16) ;RETURN IF TOO MANY CHARACTERS
SUB 0, KOUNT ;ADJUST THE OUTPUT COUNT FOR THIS LINE
MOVNM 0, KOUNT
LNOKNT: MOVE 0, @3(16) ;GET HORIZONTAL COORDINATE
MOVEM 0, LASTX
MOVE 0, @4(16) ;GET VERTICAL COORDINATE
ADDI 0, 14 ;OFFSET TO LOWER LEFT CORNER
MOVEM 0, LASTY
JSA 16, CHECK ;POSITION THE BEAM
ARG 0, LASTX
ARG 0, LASTY
SKIPN MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
JRST NOADD ;IF NOT, SKIP THIS SECTION
MOVEI 0, 104-5 ;TEST IF A LINE FEED WAS GIVEN
CAMLE 0, KOUNT
JRST NOADD ;IF NOT, JUMP TO NOADD
SUB 0, LTRCNT ;IF GIVEN, RESET CHARACTER COUNT
MOVEM 0, KOUNT
NOADD: TTCALL 1, [34] ;PUT SCOPE INTO CHARACTER MODE
MOVE 0, @1(16) ;PREPARE INITIAL BYTE POINTER
SOJ 0,
IDIVI 0, 5
ADD 0, (16)
HRRZM 0, WHERE
IMULI 1, 7
SUBI 1, 35
MOVMS 1, 1
LSH 1, 36
IOR 1, [000700000000]
IORM 1, WHERE
MOVE 1, @2(16)
SUB 1, @1(16)
LDB 0, WHERE ;GET INITIAL BYTE
JRST .+2 ;AND GO TO LOOP END TEST
LOOP: ILDB 0, WHERE
TTCALL 1, 0 ;OUTPUT THE CHARACTER
SOJGE 1, LOOP ;DECREMENT COUNT AND LOOP IF NOT DONE
SETZM 0, MODE
SETOM 0, LASTX
SETOM 0, LASTY
MOVE 0, SAVE0
MOVE 1, SAVE1
JRA 16, 5(16)
WHERE: 0
LTRCNT: 0
;
;ENTRY CRTWIP(NO ARGUMENT)
;CLEARS CURRENTLY SELECTED SCOPE SCREEN, EMPTIES INPUT
;BUFFER (TO GET RID OF CHARACTERS TRAILING STYLUS COORDS)
;AND RETURNS THE ARDS TERMINAL TO NORMAL TELETYPE MODE.
CRTWIP: 0
SETOM 0, LASTX
SETOM 0, LASTY
MOVEM 0, SAVE0 ;SAVE VALUE OF AC 0
TTCALL 1, [14] ;GIVE FORM FEED TO ERASE ARDS
MOVEI 0, 50 ;SET AC 0 TO BLANKS COUNTER
PAUSE: TTCALL 1, [40] ;GIVE BLANKS UNTIL ARDS HAS
SOSE 0, 0 ;RECOVERED FROM ERASURE FORCED BY
JRST 0, PAUSE ;GIVING A FORM FEED.
TTCALL 1, [15] ;GIVE A CARRIAGE RETURN
SETZM 0, MODE ;FORCE NEW MODE SPECIFICATION
MOVEI 0, 104 ;RESET KOUNT TO ITS MAXIMUM VALUE
SKIPE MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
MOVEM 0, KOUNT
TTCALL 11, ;CLEAR BUFFER OF CHARACTERS
;TRAILING SYLUS POSITION.
JSA 16, TTY ;PUT ARDS INTO TTY MODE
MOVE 0, SAVE0 ;RESTORE AC 0
JRA 16, (16) ;RETURN TO CALLING PROGRAM
;
;ENTRY XYZPOS(NEWX,NEWY,NEWZ)
;QUERIES ARDS ABOUT POSITION OF STYLUS AND THEN RETURNS
;POSITION INFORMATION.
;IF STYLUS MOTION IS TO BE REPRESENTED ON ARDS TERMINAL
;AT 1 TO 1 MAGNIFICATION, NEWX AND NEWY SHOULD BE USED
;AS RETURNED, TAKING THE RANGE AS 0 TO 1023 FOR EACH
;(ACTUALY THESE CAN BE NEGATIVE OR GREATER THAN 1023
;BUT SUCH VALUES SHOULD BE REJECTED).
;NEWZ IS ZERO IF STYLUS IS DEPRESSED, POSITIVE (4 OR 6)
;IF STYLUS IS WITHIN 3/8TH INCH OF TABLET, AND NEGATIVE
;(-1) IF STYLUS IS BEYOND ABOUT 3/8TH INCH OF TABLET.
CRTXYZ: 0
MOVEM 0, SAVE0 ;SAVE AC 0
MOVEM 1, SAVE1 ;SAVE AC 1
SKIPN ARDTYP ;TEST IS ARDS IS IN GRAPHIC MODE,
JSA 16, GRAFIC ;IF NOT, HAVE IT SET
NEXT: SKIPN MSTKNT ;TEST IF CHARACTER COUNT NECESSARY
JRST NEEXT ;IF NOT, JUMP AROUND THIS SECION
SKIPLE 0, KOUNT ;TEST IF CARRIAGE RETURN IS NEEDED
JRST NEXXT ;IF NOT, DONT DO THIS PART
TTCALL 1, [15] ;GIVE CARRIAGE RETURN
MOVEI 0, 104 ;RESET KOUNT TO ITS MAXIMUM VALUE
MOVEM 0, KOUNT
NEXXT: SOS KOUNT ;DECREMENT THE CHARACTER COUNT
NEEXT: TTCALL 1, [5] ;GIVE ENQUIRE CHARACTER
LOOK: TTCALL 0, 0 ;GET 1ST X CHARACTER
CAIGE 0, 100 ;REJECT IT IF LESS THAN 100
JRST LOOK
TTCALL 0, 1 ;GET 2ND X CHARACTER
CAIGE 1, 100 ;LIKEWISE REJECT IF LESS THAN 100
JRST NEXT
ANDI 0, 77 ;CLEAR EXTRA BITS OF 1ST CHARACTER
ANDI 1, 77 ;CLEAR EXTRA BITS OF 2ND CHARACTER
LSH 1, 6 ;SHIFT 2ND CHARACTER 6 BITS LEFT
IOR 0, 1 ;AND COMBINE THE 2 CHARACTERS
XORI 0, 7777 ;REVERSE BITS (WAS 1'S COMPLEMENT)
LSH 0, -1 ;CONVERT GRID FROM 4096X4096
SUBI 0, 1000 ;TO 2048X2048 WHICH MATCHES SCOPE
MOVEM 0, @(16) ;RETURN THE X ARGUMENT
TTCALL 0, 0 ;GET 1ST Y COORDINATE CHARACTER
CAIGE 0, 100 ;REJECT IT IF LESS THAN 100
JRST NEXT
TTCALL 0, 1 ;GET 2ND Y CHARACTER
CAIGE 1, 100 ;LIKEWISE REJECT IF LESS THAN 100
JRST NEXT
ANDI 0, 77 ;CLEAR EXTRA BITS OF 1ST CHARACTER
ANDI 1, 77 ;CLEAR EXTRA BITS OF 2ND CHARACTER
LSH 1, 6 ;SHIFT 2ND CHARACTER 6 BITS LEFT
IOR 0, 1 ;AND COMBINE THE 2 CHARACTERS
XORI 0, 7777 ;REVERSE BITS (WAS 1'S COMPLEMENT)
LSH 0, -1 ;CONVERT GRID FROM 4096X4096
SUBI 0, 400 ;TO 2048X2048 WHICH MATCHES SCOPE
MOVEM 0, @1(16) ;RETURN THE Y ARGUMENT
TTCALL 0, 0 ;GET SINGLE Z CHARACTER
ANDI 0, 7 ;CLEAR EXTRA BITS OF 7 CHARACTER
CAIL 0, 7 ;IF Z COORDINATE IS 7, CONVERT
MOVNI 0, 1 ;IT TO -1.
MOVEM 0, @2(16) ;RETURN THE Z ARGUMENT
SETZM 0, MODE ;FORCE NEW MODE SPECIFICATION
MOVE 0, SAVE0 ;RESTORE AC 0
MOVE 1, SAVE1 ;RESTORE AC 1
JRA 16, 3(16) ;RETURN TO CALLING PROGRAM
;
;ENTRY CRTHLT(NO ARGUMENT)
;PUTS PROGRAM TO SLEEP FOR 1 SECOND
;(USED TO PAUSE WHEN STYLUS IS LIFTED)
CRTHLT: 0
MOVEM 1, SAVE1 ;SAVE AC 1
MOVEI 1, 1 ;PUT SLEEP TIME (IN SECONDS) IN AC 1
SLEEP 1, ;PUT PRORAM TO SLEEP
MOVE 1, SAVE1 ;RESTORE AC 1
JRA 16, (16) ;RETURN TO CALLING PROGRAM
END