;       SCCSID = @(#)dosprt.asm	6.1 90/11/17
;      SCCSID = @(#)dosprt.asm		13.7 90/09/17

PAGE	,132
NAME	DOSPRT
TITLE	DOSPRT.ASM - MS-DOS miscellaneous debug printf support

;***	DOSPRT.ASM
;
;
;	Contains support for calling the debugger print routines from
;	32 bit C code.
;

.xlist
	include debseg.inc
	include debmac.inc
	include mi.inc
	include dosseg.inc
	include basemaca.inc		; must include after debmac.inc
					;  (conflicting EndProc macro)
	include osmaca.inc
.list

CpuMode 386

	extrn	dputs:near

BUFSZ	equ	256


DDATA	segment

printfbuf	db	BUFSZ dup(?)

DDATA	ends


_DATA	segment
	assume	ds:FLAT

	public	_pprintfbuf
_pprintfbuf	dd	offset FLAT:printfbuf

	public	_cprintfbuf
_cprintfbuf	dd	BUFSZ

_DATA	ends


	FARCODE LOW
CODE	segment

;***	fdputs - stub to pass control to dputs
;
;	16 bit routine callable from 32 bit code.  Passes control to
;	the debugger's dputs routine.
;
;	ENTRY	NONE
;	EXIT	NONE
;	USES	NONE

	ASSUME	DS:NOTHING, ES:NOTHING, SS:NOTHING
Procedure fdputs, <far16, near>

	call	dputs 		; call the real McCoy
	ret

EndProc fdputs

CODE	ends



	FARCODE HIGH32
_TEXT	segment


;***	_dputs - stub to pass control to dputs
;
;	This procedure is nothing more than a C-callable
;	stub to pass control to the debuger's dputs routine
;	after setting up registers.
;
;	ENTRY	NONE
;	EXIT	NONE
;	USES	EAX

	ASSUME	DS:NOTHING, ES:NOTHING, SS:NOTHING
Procedure _dputs, NEAR

	push	ds
	push	esi
	mov	si, DBGDATA
	mov	ds, si
	mov	si, offset DBGDATA:printfbuf
	CALL16	fdputs			; call dputs function
	pop	esi
	pop	ds
	RETC

EndProc _dputs

_TEXT	ends
end
