
call_iap_write:
	PUSH    IEN0                     ;disable interrupts
        CLR     EA
        MOV     B,CMOD
        MOV     R2,B                     ; store copy of CMOD
        JNB     B.6,?IAPTAG11            ; if watchdog enabled then disable
	ANL 	CMOD,#0BFH
?IAPTAG11:
	MOV	ACC, #55H
	MOV	DPH, #23H
	MOV 	DPL, #70H
	MOV     R1, #02H
	ANL 	FCF, #0FEH              ; enable bootrom
        CALL    01FF0H                   ; call iap routine
	MOV 	R7, ACC
        ORL	FCF,#01H		 ; disable bootrom
        MOV     CMOD,R2                  ; restore CMOD (restore watchdog state)
        POP     IEN0                     ; restore interrupts to initial state
        RET  

