þ a‹R þ d 
þ w ÿÿÿÿÿÿÿÿþ m
Z<     þ hý	 oP   þ nSystem-wide$NOLIST
	NAME	MiscRamCode

$INCLUDE (``OsIncs`Windows.ASM.Inc~Text~)

RAM_CGROUP GROUP	RAM_CODE

          PUBLIC    LineHeight, CharWidth
	PUBLIC    BaseLine, CharHeight
	PUBLIC    OsWhereAmI, OsDelay
	PUBLIC    GetMeWindowState

RAM_CODE	SEGMENT	PUBLIC	'CODE'
	ASSUME	CS:RAM_CGROUP

	EXTRN     CpWhoAmI: NEAR
	EXTRN     CpDelay: NEAR

; FUNCTION GetMeWindowState: SELECTOR;
;
;
pcb STRUC
  whoCares  DB 78 DUP (?)
  windowOff DW ?
  windowSeg DW ?
pcb ENDS

GetMeWindowState PROC NEAR
	CALL      CpWhoAmI
	MOV       ES, AX
	MOV       AX, ES:windowSeg
	RET
GetMeWindowState ENDP

; FUNCTION LineHeight: BYTE;
;
; This routine will return the lineheight of the 
; current font. The lineHeight will be put in AL.
$LIST
LineHeight PROC FAR

	PUSH	DS
	CALL	GetMeWindowState
	MOV	DS,AX

	LES	BX,DS:wsPFontTable
	XOR	AH,AH
	MOV	AL, BYTE PTR ES:[BX+3] ;LineHeight
	OR        AL, AL
	JNZ       DoneLineHeight 
	MOV	AL, BYTE PTR ES:[BX+2] ;CharHeight
	ADD       AL, 2

DoneLineHeight:
	POP	DS
	RET

LineHeight ENDP

; FUNCTION CharHeight: BYTE;
;
; This routine will return the charheight of the 
; current font. The charHeight will be put in AL.
$LIST
CharHeight PROC FAR

	PUSH	DS
	CALL	GetMeWindowState
	MOV	DS,AX

	LES	BX,DS:wsPFontTable
	XOR	AH,AH
	MOV	AL, BYTE PTR ES:[BX+2] ;CharHeight

	POP	DS
	RET

CharHeight ENDP

$EJECT


; FUNCTION CharWidth: BYTE;
;
; This routine will return the CharWidth of the 
; current font. The charwidth will be put in AL.
$LIST
CharWidth PROC FAR

	PUSH	DS
	CALL	GetMeWindowState
	MOV	DS,AX

	LES	BX,DS:wsPFontTable
	XOR	AH,AH
	MOV	AL, BYTE PTR ES:[BX+1] ;CharWidth

	POP	DS
	RET

CharWidth ENDP

; FUNCTION BaseLine: BYTE;
;
; This routine will return the baseline of the 
; current font. The baseline will be put in AL.
$LIST
BaseLine PROC FAR

	PUSH	DS
	CALL	GetMeWindowState
	MOV	DS,AX

	LES	BX,DS:wsPFontTable
	XOR	AH,AH
	MOV	AL, BYTE PTR ES:[BX+4] ;BaseLine
	OR        AL, AL
	JNZ       DoneBaseLine
	MOV	AL, BYTE PTR ES:[BX+2] ;CharHeight
	DEC       AL

DoneBaseLine:
	POP	DS
	RET

BaseLine  ENDP

$EJECT


; FUNCTION OsWhereAmI: SELECTOR;
;
; This routine will return the baseline of the 
; current font. The baseline will be put in AL.
$LIST
OsWhereAmI PROC FAR
	CALL      CpWhoAmI
	RET
OsWhereAmI  ENDP


; PROCEDURE OsDelay (time);
;  DCL time  WORD;
;
; This routine will return the baseline of the 
; current font. The baseline will be put in AL.
$LIST
; Stack looks like:
;    ReturnIp
;    ReturnCS
;    time
OsDelay PROC FAR
	MOV  BX, SP
	PUSH WORD PTR SS:[BX+4]
	CALL CpDelay
	RET 2
OsDelay  ENDP


RAM_CODE	ENDS

END
