PAGE	74,97
	TITLE	Daffodil Subroutines
; DaffSubs.asm
; Last modified July 26, 1983  3:33 PM by Diebert

; These are the subroutines used by the Daffodil Debugging Monitor
	PAGE
	INCLUDE	DaffEQUs.d
	INCLUDE	DaffExtD.d
CodeSegment	SEGMENT	PUBLIC 'CodeSegment'
	ASSUME		CS:CodeSegment, DS:DataSegment
	EXTRN	Herald:	NEAR
	EXTRN	Prompt:	NEAR
	EXTRN	RegNameTable:	NEAR
	PAGE
	PUBLIC	ConvertBinary
ConvertBinary	PROC

; This subr converts the string pointed to by BP to binary.  As many 
; preceeding 0 can be added.
;
;	Input Registers
;	BP	Contains a pointer to the start of the area to be converted
;	CL	Contains the length of the string to be converted
;
;	Output Registers
;	AX	Contains the converted value
;
;	Output Memory locations
;	None
;
;	Registers not returned as called
;	CX, FR, CI
;
;	Returns Carry Flag if converted ok


ConvertBinary	ENDP
		PAGE
		PUBLIC	GetCmd
GetCmd		PROC

; This subr builds the command string from the input device through
; the use of GetChar & PutChar.  The string collection is terminated
; when a control character, "/", "\", "↑", CR or LF is encountered.
; All typed keystrokes are echoed except for the command char.
;
;	Input Registers
;	None
;
;	Output Registers
;	DL	Byte value of the command character
;	DH	The length of the string not counting the command char
;
;	Output Memory locations
;	InStr	Contains the input string without the command char
;	StrLen	Contains the length of the string not counting the command char
;
;	Registers not returned as called
;	FR
;

GetCmd		ENDP
		PAGE
		PUBLIC	GetNewWord
GetNewWord	PROC

; This subr builds a binary number from the input device through
; the use of GetChar & PutChar.  The number collection is terminated
; when a "/", "\", "↑", CR or LF is encountered.
; All typed keystrokes are echoed except for the command char.
;
;	Input Registers
;	None
;
;	Output Registers
;	DL	Byte value of the command character
;	CX	Binary word as entered
;
;	Output Memory locations
;	None
;
;	Registers not returned as called
;	FR
;
;	Carry Flag is set if entered value was a valid number

GetNewWord	ENDP
		PAGE
		PUBLIC	LookupRegs
LookupRegs	PROC

; This subr takes the string in AX and searches for a match in the Register
; lookup table.
;
;	Input Registers
;	AX	Contains the 2 byte str to compare against table
;
;	Output Registers
;	BX	Offset of the sent register in the table
;
;	Output Memory locations
;	None
;
;	Registers not returned as called
;	CX, FR
;
;	Returns Carry Flag if found


LookupRegs	ENDP
		PAGE
		PUBLIC	PrintAddress
PrintAddress	PROC

; This subr prints to the output device (using PutChar) the address string 
; as specified by TargetSeg:TargetOffset.  Address is printed in different
; ways based on TargetMode.
;
;	Input Registers
;	None
;
;	Output Registers
;	None
;
;	Output Memory locations
;	None
;
;	Registers not returned as called
;	CX, FR, CI
;


PrintAddress	ENDP
		PAGE
		PUBLIC	PrintChar
PrintChar	PROC

; This subr prints a a sigle char to the output device (using PutChar).
; The char to print is in AL

;	Input Registers
;	AL	Character to be printed
;
;	Output Registers
;	None
;
;	Output Memory locations
;	None
;
;	Registers not returned as called
;	AL, CX, FR, CI
;


PrintChar	ENDP
		PAGE
		PUBLIC	PrintCRLF
PrintCRLF	PROC

; This subr prints a CRLF to the output device (using PutChar).
;
;	Input Registers
;	None
;
;	Output Registers
;	None
;
;	Output Memory locations
;	None
;
;	Registers not returned as called
;	CX, FR, CI
;


PrintCRLF	ENDP
		PAGE
		PUBLIC	PrintStr
PrintStr	PROC

; This subr takes the string specified by BX and sends it to the output device
; using PutChar.
;
;	Input registers
;	BP	Pointer to start of string
;	CL	Length of the string to be printed
;
;	Output Registers
;	None
;
;	Output Memory locations
;	None
;
;	Registers not returned as called
;	CX
;

PrintStr	ENDP
		PAGE
		PUBLIC	ReadWord
ReadWord	PROC

; This subr reads the location specified by TargetMode, TargetSeg and
; TargetOffset.
;
;	Input registers
;	None
;
;	Output Registers
;	CX	Contains the value at the specified address
;
;	Output Memory locations
;	None
;
;	Registers not returned as called
;	CX
;

ReadWord	ENDP
		PAGE
		PUBLIC	WriteWord
WriteWord	PROC

; This subr writes the location specified by TargetMode, TargetSeg and
; TargetOffset from the CX register.
;
;	Input registers
;	CX	Contains the value to be writted at the specified address
;
;	Output Registers
;	None
;
;	Output Memory locations
;	None
;
;	Registers not returned as called
;	None
;

ReadWord	ENDP