
RSEG        SOFT_BOOT_PROCESS
boot_process:

    mov     A,FCON
    cjne    A,#PROG_BOOT_VALUE,atmel_init   ; test FCON F0h or 00h
    mov     DPL,#SBV_ADDRESS
    acall   fm_read_xrow            ; read Software Boot Vector: A <- SBV
    mov     R0,A                    ; save SBV

    clr     C
    subb    A,#BOOT_BASE_ADDRESS    ; if SBV >= boot base address
    jnc     atmel_init              ; exec Atmel boot else User boot

user_boot:
    mov     DPH,R0                  ; restore SBV
    clr     A
    mov     DPL,A
    jmp     @A+DPTR                 ; jump to user's boot loader at @ [SBV]00h

atmel_init:

ret
