TRIPOS PDP-11 Assembler version 1.4


                                      ; Constants about machine.

              020000                  COREND	= 8.*1024.	; First unusable word


              002000                  WIDTH	= 1024.		; Height of display
              001400                  HEIGHT	= 768.		; Width of display

                                      ; Address of registers.

              172000                  DPC     = 172000        ; VT40 Program counter
              172002                  DSR     = 172002        ; VT40 Status register
              172004                  XSR     = 172004        ; X status register
              172006                  YSR     = 172006        ; Y status register

                                      ; Recommended mnemomics

              100000                  CHAR    = 100000        ; Character mode
              104000                  SHORTV  = 104000        ; Short vector mode
              110000                  LONGV   = 110000        ; Long vector mode
              114000                  POINT   = 114000        ; Point mode
              120000                  GRAPHX  = 120000        ; Graphplot X mode
              124000                  GRAPHY  = 124000        ; Graphplot Y mode
              130000                  RELATV  = 130000        ; Relative point mode

              002000                  INT0    = 2000          ; Intensity modes
              002200                  INT1    = 2200
              002400                  INT2    = 2400
              002600                  INT3    = 2600
              003000                  INT4    = 3000
              003200                  INT5    = 3200
              003400                  INT6    = 3400
              003600                  INT7    = 3600

              000100                  LPOFF   = 100           ; Light pen off
              000140                  LPON    = 140           ; and on

              000020                  BLKOFF  = 20            ; Blink off
              000030                  BLKON   = 30            ; and on

              000004                  LINE0   = 4             ; Solid line
              000005                  LINE1   = 5             ; Long dash
              000006                  LINE2   = 6             ; Short dash
              000007                  LINE3   = 7             ; Dot dash

              160000                  DJMP    = 160000        ; Display jump
              164000                  DNOP    = 164000        ; Display NOP

              170000                  STATSA  = 170000        ; Load status A
              173400                  DSTOP   = 173400        ; Display stop and interrupt

              001400                  SINON   = 1400          ; Stop interrupt on
              001000                  SINOFF  = 1000          ; Stop interrupt off
              000200                  LPLITE  = 200           ; Light pen hit on
              000300                  LPDARK  = 300           ; and off

              000040                  ITAL0   = 40            ; Italics off
              000060                  ITAL1   = 60            ; and on

              000004                  SYNC    = 4             ; Halt and resume in Sync

              174000                  STATSB  = 174000        ; Load status B
              000100                  INCR    = 100           ; Graphplot increment

              040000                  INTX    = 40000         ; Intensify vector or point
              001777                  MAXX    = 1777          ; Max delta-x
              001377                  MAXY    = 1377          ; Max delta-y

              020000                  MINUSX  = 20000         ; -ve delta-x
              020000                  MINUSY  = 20000         ; -ve delta-y

              017600                  MAXSX   = 17600         ; Max delta-x in short mode
              000077                  MAXSY   = 77            ; Max delta-y

              020000                  MISVX   = 20000         ; -ve delta-x
              000100                  MISVY   = 100           ; -ve delta-y

              000000'                         .PSECT

                                      ;       Simple PDP-11 program

      000000' 012706  017776          	MOV	#COREND-2,SP	; Set up stack
      000004' 004767  000024          	JSR	PC,MAIN		; write DPROG
      000010'                         DISPLAY:
      000010' 012723  160000          	MOV	#DJMP,(R3)+	; fix up end of display program
      000014' 012723  000150'         	MOV	#DLOOP,(R3)+

      000020' 012737  000146' 172000  	MOV	#DPROG,@#DPC	; start displayprocessor runnig

      000026' 004767  000002          MLOOP:	JSR	PC,MAIN
      000032' 000775                  	BR	MLOOP

                                      ; R2 - x
                                      ; R3 - DPC when writing display file
      000034' 012703  000160'         MAIN:	MOV	#END,R3		; where to start writing point data
      000040' 005002                  	CLR	R2		; start x at 0

      000042'                         LOOP:
                                      	; compute next point on graph
      000042' 010200                  	MOV	R2,R0
      000044' 013701  177570          	MOV	@#177570,R1
      000050' 004767  000014          	JSR	PC,DIVIDE
      000054' 010023                  	MOV	R0,(R3)+
      000056' 005202                  	INC	R2
      000060' 022702  001777          	CMP	#WIDTH-1,R2
      000064' 100366                  	BPL	LOOP		; loop until x>WIDTH-1
      000066' 000207                  	RTS	PC


                                      	; R0 := R0 / R1, remainder in R2, R1 is positivised
                                      	; R0 is top, shifted into R2 one bit at a time.
                                      	; R3 is the loop counter.
      000070'                         DIVIDE:
      000070' 010246                  	MOV	R2,-(SP)
      000072' 010346                  	MOV	R3,-(SP)
      000074' 005701                  	TST	R1	; Validate divisor
      000076' 001421                  	BEQ	DIV0	; divide by 0!
      000100' 100001                  	BPL	DIV1
      000102' 005401                  	NEG	R1
      000104'                         DIV1:
      000104' 005002                  	CLR	R2
      000106' 012703  000017          	MOV	#15.,R3		; 16 iterations
      000112'                         DIV2:
      000112' 006300                  	ASL	R0
      000114' 006102                  	ROL	R2
      000116' 020201                  	CMP	R2,R1		; can we subtract bottom from top?
      000120' 103403                  	BCS	DIV3		; no
      000122' 160102                  	SUB	R1,R2		; yes - do it.
      000124' 052700  000001          	BIS	#1,R0
      000130' 005303                  DIV3:	DEC	R3
      000132' 100367                  	BPL	DIV2

      000134' 012603                  DIVEND:	MOV	(SP)+,R3
      000136' 012602                  	MOV	(SP)+,R2
      000140' 000207                  	RTS	PC

      000142'                         DIV0:	; divide by 0.  return 0. (any other ideas?)
      000142' 005000                  	CLR	R0
      000144' 000773                  	BR	DIVEND
                                      ; end of DIVIDE

      000146'                         DPROG:	
      000146' 174101                  	STATSB+INCR+1

      000150' 114000                  DLOOP:	POINT
      000152' 000000                  	0
      000154' 000000                  	0
      000156' 124000                  	GRAPHY
      000160'                         END:	.END

No errors detected

Assembly statistics (words):

           Absolute   Relocatable
Code            0          56
Reloc. info     0           3

Space used for symbol table: 1065 words
Total workspace used: 1266 words
Assembly complete
