;		lea	esi,napis
;		mov	ecx,offset napis2
;		sub	ecx,offset napis
;		call	draw_string

.386p
CODE32 SEGMENT PARA PUBLIC USE32
ASSUME cs:CODE32, ds:CODE32

		INCLUDE pmode.INC
                PUBLIC  draw_font
                PUBLIC  draw_string
                PUBLIC  draw_font2
                PUBLIC  draw_string2
                PUBLIC  fx
                PUBLIC  fy
		EXTRN	draw_where:DWORD

		font_wys 	equ 10
		left_margin	equ 40
		fx		dd left_margin ;normal x
		fy		dd 40*320 ;always must be mul by 320
		fc		db 3eh

                INCLUDE	font.ofs
		INCLUDE	font.db

draw_font	PROC
		sub	al,32
		movzx	eax,al
		mov	esi,dword ptr [offset font+eax*4]
		mov	edi,draw_where
		add	edi,fx
		add	edi,fy
		movzx	edx,byte ptr [esi]
		inc	esi
		mov	ecx,font_wys
	@c1:	push	ecx
		mov	ecx,edx
	@g1:	push	ecx
		mov	al,[esi]
		or	al,al
		jz	nicc
		mov	al,fc
		mov	[edi],al
	nicc:	inc	esi
		inc	edi
		pop	ecx
		loop	@g1
		pop	ecx
		add	edi,320
		sub	edi,edx
		loop	@c1
		add	fx,edx
		inc	fx
		ret
draw_font	ENDP

draw_font2	PROC
		sub	al,32
		movzx	eax,al
		mov	esi,dword ptr [offset font+eax*4]
		mov	edi,draw_where
		add	edi,fx
		add	edi,fy
		movzx	edx,byte ptr [esi]
		inc	esi
		mov	ecx,font_wys
	@c1z:	push	ecx
		mov	ecx,edx
	@g1z:	push	ecx
		mov	al,[esi]
		or	al,al
		jz	niccz
		mov	al,fc
		mov	[edi],al
		mov	[edi+1],al
	niccz:	inc	esi
		inc	edi
		inc	edi
		pop	ecx
		loop	@g1z
		pop	ecx
		add	edi,320
		sub	edi,edx
		sub	edi,edx
		loop	@c1z
		add	fx,edx
		add	fx,edx
		inc	fx
		inc	fx
		ret
draw_font2	ENDP

draw_string	PROC
		push	esi ecx
		mov	al,byte ptr [esi]
		cmp	al,'$'
		jne	@n1
		mov	fx,left_margin
		add	fy,320*14
		jmp	@ds2
	@n1:	call	draw_font
	@ds2:	pop	ecx esi 
		inc	esi
		loop	draw_string
		ret
draw_string	ENDP

draw_string2	PROC
		push	esi ecx
		mov	al,byte ptr [esi]
		cmp	al,'$'
		jne	@n221
		mov	fx,left_margin
		add	fy,320*14
		jmp	@ds222
	@n221:	call	draw_font2
	@ds222:	pop	ecx esi 
		inc	esi
		loop	draw_string2
		ret
draw_string2	ENDP


CODE32 ENDS
END
