ds_name		db	'MOZ\SVFILE',0


look_me:
	 call sub_esi
	 dd 0,0
	 dw	 1,0,1,1,640,480,15,5,0,0



paint_wd:
	 SET_P nddak
	 SET_P nddaka
	 SET_P nddakc
	 SET_P ndkan
	 WD_LEFT
	 ret
re_paint:
mouse_in:
	 ret

be_called:
	 call mozidt_d
	    KAKU 384,edi
	    CALL_P nddak

	 YOMU ax,382
	   cmp ax,1
	   je savef

	   ret

savef:
h_get:
	 CALL_P ndkan
	 cmp edx,0
	 je kaeret

h_get0:
	 mov esi,edx

	 call f_name

h_get1:
	 mov al,[esi]
	 mov [edx],al
	 inc esi
	 inc edx
	 cmp al,0
	 jne h_get1


	        call f_name
	        mov esi,edx

	       call mozidt_d2
	         mov ecx,16	;64/4
	         cld
	         rep movsd

	       call mozidt_d2

	       KAKU 384,edi
	       CALL_P nddakc

	       YOMU ax,382

	       cmp ax,1
	       jne h_get

	call chgram


g_hndl:
	 call f_name

	 mov al,2
	 mov ah,3Dh
	 int 21h

	   jc fnashi

	 call f_handl
	 mov [edi],ax

	       call mozidt_d3

	       KAKU 384,edi
	       CALL_P nddaka

	       YOMU ax,382

	       cmp ax,1
	       je fnashi

	       cmp ax,2
	       jne kaeret


f_move1:
	 mov ecx,0
	 mov edx,0

	 mov al,2
	 mov ah,42h

	 call f_handl
	 mov bx,[edi]
	 int 21h


fwrite1:

	 RAM2 edi		; ファイル情報
	 mov ecx,30[edi]

	RAM0 edx

	 call f_handl
	 mov bx,[edi]
	 mov al,0
	 mov ah,40h
	 int 21h


f_move:
	 mov ecx,0
	 mov edx,0

	 mov al,2
	 mov ah,42h

	 call f_handl
	 mov bx,[edi]
	 int 21h


f_write:
		 RAM2 edx
		mov ecx,50[edx]

		add edx,1000
		add edx,ecx
		mov ax,0a0dh
		mov [edx],ax


	 RAM2 edx
	mov ecx,50[edx]
	add ecx,2

	add edx,1000


	 call f_handl
	 mov bx,[edi]
	 mov al,0
	 mov ah,40h
	 int 21h

f_clos:
	 call f_handl
	 mov bx,[edi]
	 mov ah,3Eh
	 int 21h

	 ret


chgram:
	RAM1 edi
	mov esi,edi
	RAM0 edi

	RAM2 edx
	mov ecx,40[edx]


chgram1:
	mov al,[esi]
	cmp al,0
	je chkcr

chgram2:
	mov [edi],al
	inc esi
	inc edi

	dec ecx

	cmp ecx,0
	jg chgram1

	ret


chkcr:
	mov bl,-1[esi]
	cmp bl,0dh
	je chkcr1

	inc esi
	jmp chgram1

chkcr1:
	mov al,0ah
	jmp chgram2


;----------------------------

fnashi:
	 RAM2 edi		; ファイル情報
	 mov ecx,30[edi]

	   call f_name

	RAM0 edi

	call ireru1

;;g_hndl:
	 call f_name

	 mov al,2
	 mov ah,3Dh
	 int 21h

	 call f_handl
	 mov [edi],ax

	jmp f_move

ireru1:
	 M_SAVE


;--------------------------------------




f_name:
	 call sub_edx
	 db	80 dup(0)



kaeret:
	 ret



f_handl:
	 call sub_edi
	 dw	 0


mozidt_d2:
	 call sub_edi
	 db  68 dup(0)
	 db '  ＯＫ  変える  ',0




mozidt_d:
	 call sub_edi
db 'ファイルをセーブしますか?',0
	 db 'SAVEするしない  ',0


mozidt_d3:
	 call sub_edi
db 'そのファイルは既にあります',0
	 db ' 上書き 付け足し やめる ',0



nddak:
	 call sub_edi
	 dw	 ?
	 db 'DAKUHI2',0

nddaka:
	 call sub_edi
	 dw	 ?
	 db 'DAKUHIA',0

ndkan:
	 call sub_edi
	 dw	 ?
	 db 'KANU',0

nddakc:
	 call sub_edi
	 dw	 ?
	 db 'DAKUHI3',0



p_call:
	 M_P_CALL
p_set:
	 M_P_SET


