	.TITLE	DTT

;+
; Copyright (c) 2012 Oleg Safiullin <form@pdp-11.org.ru>
;
; Permission to use, copy, modify, and distribute this software for any
; purpose with or without fee is hereby granted, provided that the above
; copyright notice and this permission notice appear in all copies.
;
; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;-

;+
; Use the following commands to apply this patch:
;
; .MAC BPNPAT
; .REN DTTN.OBJ DTTN.OLD
; .R PAT
; *DTTN=DTTN.OLD,BPNPAT
; *^C
;
; and relink BASIC-PLUS.
;-

	.PSECT	DTT
	.=.+416
	CALL	FIXDAT

	.PSECT	FIXDAT,I,RO,LCL
FIXDAT:	MOV	R5,-(SP)
	ASR	R5
	SWAB	R5
	BIC	#^C140,R5
	ADD	@R1,R5
	ADD	#72.,R5
	CLR	@R1
	MOV	#16.,R2
10$:	ASL	R5
	ROL	@R1
	CMP	@R1,#100.
	BLO	20$
	SUB	#100.,@R1
	INC	R5
20$:	DEC	R2
	BNE	10$
	ADD	#100.,@R1
	MOV	(SP)+,R5
	RETURN

	.END
