TRIPOS PDP-11 Assembler version 1.4


                                      ; GT40 demo program.
                                      ; Display a blob of light which follows the light pen around the screen.
                                      ; (ie it can be dragged).
                                      ; Martin Guy, June 1988.

                                      ; Constants about machine.

              040000                  COREND	= 40000		; 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  037776          	MOV	#COREND-2,SP	; Set up stack

                                      	; Constants held in registers for quick access
      000004' 012705  172000          	MOV	#DPC,R5		; Address of DPU program counter
      000010' 012704  000116'         	MOV	#STARTY,R4	; Address of starting y coordinate in DPROG
      000014' 012703  000112'         	MOV	#DLOOP,R3	; continuation address for DPU after DSTOP

                                      	; Set up interrupt vectors
      000020' 012737  000060' 000320  	MOV	#STOPINTR,@#320	; DPU DSTOP instruction	(priority level 4)
      000026' 012737  000200  000322  	MOV	#200,@#322	; new CPU priority = 4 - no nested intrs
      000034' 012737  000100' 000324  	MOV	#LPINTR,@#324	; Light Pen hit
      000042' 012737  000200  000326  	MOV	#200,@#326	; new CPU priority = 4 - no nested intrs

      000050' 012715  000106'         	MOV     #DPROG,(R5)	; Start graphics processor
      000054' 000001                  LOOP:	WAIT			; Mouch about...
      000056' 000776                  	BR	LOOP
                                      	
                                      ; Display program: full-screen raster scan

                                      ; What to do on a Display Stop interrupt
      000060'                         STOPINTR:
      000060' 005314                  	DEC	(R4)		; move down one raster line
      000062' 005314                  	DEC	(R4)		; move down one raster line
      000064' 100402                  	BMI	L1		; if off bottom of screen, start again at top
      000066' 010315                  L2:	MOV     R3,(R5) 	; Restart graphics processor
      000070' 000002                  	RTI
                                      	
      000072' 012714  001377          L1:	MOV	#HEIGHT-1,(R4)
      000076' 000773                  	BR	L2


                                      ;		Light pen interrupt service routine
      000100'                         LPINTR:
      000100' 012715  000001          	MOV	#1,(R5)		; Continue display
      000104' 000002                  	RTI


                                      ;		Display program
      000106'                         DPROG:
                                      	; Set up, point mode, intensity 4, no light pen or
                                      	; blink and solid lines. Move to (500, 500). Enter
                                      	; long vector mode

      000106' 116524                  	POINT+INT2+LPOFF+BLKOFF+LINE0
      000110' 171240                  	STATSA+SINOFF+LPLITE+ITAL0
                                      	
      000112'                         DLOOP:
      000112' 114000                  	POINT
      000114' 000000                  STARTX:	0
      000116' 001377                  STARTY:	HEIGHT-1
      000120' 110000                  	LONGV
      000122' 041777                  DX:	INTX+WIDTH-1		; left to right
      000124' 000000                  DY:	0
      000126' 000000                  	0			; down a line
      000130' 020001                  	MINUSY+1
      000132' 061777                  	INTX+MINUSX+WIDTH-1	; and back
      000134' 000000                  	0
      000136' 173400                  	DSTOP

      000140'                         END:	.END

No errors detected

Assembly statistics (words):

           Absolute   Relocatable
Code            0          48
Reloc. info     0           5

Space used for symbol table: 1060 words
Total workspace used: 1260 words
Assembly complete
