
          LOAD EQU 00H
          EP EQU 68H

INITALIZE:MOV R3,#64        
          MOV R4,#04H
          MOV R5,#40H
          MOV R7,#00H
PGM_USER: MOV FMCON,#LOAD ;load command,
          MOV FMADRH,R4 ;get high address
          MOV FMADRL,R5 ;get low address
          MOV A,R7 ;
          MOV R0,A ;get pointer
LOAD_PAGE:
          MOV FMDAT,@R0 ;write data to
          INC R0 ;point to next
          DJNZ R3,LOAD_PAGE ;do until count
          MOV FMCON,#EP ;else erase &
          MOV R7,FMCON ;copy status
          MOV A,R7 ;read status
          ANL A,#0FH ;save only four
          JNZ BAD ;
          CLR C ;clear error
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ADDITIONAL CODE TO LOAD 32H TO LOCATIONS 440H TO 480H
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
          MOV R3,#64 
          MOV FMCON,#LOAD ;load command
          MOV FMADRH,R4 ;get high address
          MOV FMADRL,R5 ;get low address 
LOAD_PAGE1:
          MOV FMDAT,#32H ;write data to FMDATA
          DJNZ R3,LOAD_PAGE ;do until count
          RET ;and return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
BAD:      SETB C ;set error flag
          RET ;and return
