; original File = E:\DOCS\Schemes\step_motor_629.HEX

    processor 12F629
    #include <P12F629.INC>
    __config 0x3F84
;   _CPD_OFF & _CP_OFF & _BODEN_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF 
;   & _INTRC_OSC_NOCLKOUT 

; RAM-Variable
LRAM_0x20 equ 0x20
LRAM_0x21 equ 0x21
LRAM_0x22 equ 0x22
LRAM_0x23 equ 0x23
LRAM_0x24 equ 0x24

; Program

    Org 0x0000

;   Reset-Vector
    CLRWDT
    GOTO LADR_0x00EB

    Org 0x0004

;   Interrupt-Vector
    MOVWF LRAM_0x20
    MOVF STATUS,W
    MOVWF LRAM_0x21
    MOVF LRAM_0x21,W
    MOVWF STATUS
    SWAPF LRAM_0x20,F
    SWAPF LRAM_0x20,W
    RETFIE
LADR_0x000C
    ANDLW 0x03
    ADDWF PCL,F
    RETLW 0x01
    RETLW 0x10
    RETLW 0x02
    RETLW 0x20
LADR_0x0012
    MOVF GPIO,W          ; !!Bank!! GPIO - TRISIO
    ANDLW 0x0C
    MOVWF LRAM_0x24
    CALL LADR_0x00E1
    MOVF GPIO,W          ; !!Bank!! GPIO - TRISIO
    ANDLW 0x0C
    SUBWF LRAM_0x24,W
    BTFSS STATUS,Z
    RETURN
    MOVF LRAM_0x24,W
    ANDLW 0x0C
    BTFSC STATUS,Z
    GOTO LADR_0x0036
    BTFSS LRAM_0x24,2
    GOTO LADR_0x002E
    BTFSS LRAM_0x24,3
    GOTO LADR_0x0032
    CALL LADR_0x00E1
    CLRF GPIO            ; !!Bank!! GPIO - TRISIO
    CALL LADR_0x00E1
    CALL LADR_0x00E1
    CALL LADR_0x00E1
    CALL LADR_0x00E1
    CALL LADR_0x00E1
    CALL LADR_0x00E1
    CALL LADR_0x00E1
    CALL LADR_0x00E1
    RETURN
LADR_0x002E
    INCF LRAM_0x23,W
    ANDLW 0x03
    MOVWF LRAM_0x23
    GOTO LADR_0x00C2
LADR_0x0032
    DECF LRAM_0x23,W
    ANDLW 0x03
    MOVWF LRAM_0x23
    GOTO LADR_0x00C2
LADR_0x0036
    NOP
    NOP
    NOP
    GOTO LADR_0x00C2
    NOP
    NOP
    NOP
    NOP
    DB 0x28              ; !! Unknown Command
    DB 0x43              ; !! Unknown Command
    DB 0x29              ; !! Unknown Command
    NOP
    DB 0x43              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x50              ; !! Unknown Command
    DB 0x59              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    DB 0x49              ; !! Unknown Command
    DB 0x47              ; !! Unknown Command
    DB 0x48              ; !! Unknown Command
    DB 0x54              ; !! Unknown Command
    NOP
    DB 0x32              ; !! Unknown Command
    DB 0x30              ; !! Unknown Command
    DB 0x31              ; !! Unknown Command
    DB 0x30              ; !! Unknown Command
    NOP
    DB 0x2D              ; !! Unknown Command
    NOP
    DB 0x49              ; !! Unknown Command
    DB 0x47              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    NOP
    DB 0x47              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    DB 0x53              ; !! Unknown Command
    DB 0x4B              ; !! Unknown Command
    DB 0x49              ; !! Unknown Command
    DB 0x59              ; !! Unknown Command
    DB 0x28              ; !! Unknown Command
    DB 0x4D              ; !! Unknown Command
    DB 0x41              ; !! Unknown Command
    DB 0x4D              ; !! Unknown Command
    DB 0x45              ; !! Unknown Command
    DB 0x44              ; !! Unknown Command
    DB 0x29              ; !! Unknown Command
    NOP
    DB 0x2D              ; !! Unknown Command
    NOP
    DB 0x57              ; !! Unknown Command
    DB 0x57              ; !! Unknown Command
    DB 0x57              ; !! Unknown Command
    DB 0x2E              ; !! Unknown Command
    DB 0x45              ; !! Unknown Command
    DB 0x4C              ; !! Unknown Command
    DB 0x45              ; !! Unknown Command
    DB 0x43              ; !! Unknown Command
    DB 0x54              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x41              ; !! Unknown Command
    DB 0x56              ; !! Unknown Command
    DB 0x54              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x2E              ; !! Unknown Command
    DB 0x4E              ; !! Unknown Command
    DB 0x41              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x44              ; !! Unknown Command
    DB 0x2E              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    DB 0x55              ; !! Unknown Command
    NOP
    NOP
    DB 0x45              ; !! Unknown Command
    DB 0x2D              ; !! Unknown Command
    DB 0x6D              ; !! Unknown Command
    DB 0x61              ; !! Unknown Command
    DB 0x69              ; !! Unknown Command
    DB 0x6C              ; !! Unknown Command
    DB 0x3A              ; !! Unknown Command
    DB 0x41              ; !! Unknown Command
    DB 0x56              ; !! Unknown Command
    DB 0x54              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x45              ; !! Unknown Command
    DB 0x4C              ; !! Unknown Command
    DB 0x45              ; !! Unknown Command
    DB 0x43              ; !! Unknown Command
    DB 0x54              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    NOP
    DB 0x4D              ; !! Unknown Command
    DB 0x41              ; !! Unknown Command
    DB 0x49              ; !! Unknown Command
    DB 0x4C              ; !! Unknown Command
    DB 0x2E              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    DB 0x55              ; !! Unknown Command
    NOP
    NOP
    NOP
    NOP
    DB 0x42              ; !! Unknown Command
    DB 0x49              ; !! Unknown Command
    DB 0x50              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x4C              ; !! Unknown Command
    DB 0x41              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    NOP
    DB 0x53              ; !! Unknown Command
    DB 0x54              ; !! Unknown Command
    DB 0x45              ; !! Unknown Command
    DB 0x50              ; !! Unknown Command
    NOP
    DB 0x4D              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x54              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    NOP
    DB 0x43              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x4E              ; !! Unknown Command
    DB 0x54              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    DB 0x4F              ; !! Unknown Command
    DB 0x4C              ; !! Unknown Command
    DB 0x4C              ; !! Unknown Command
    DB 0x45              ; !! Unknown Command
    DB 0x52              ; !! Unknown Command
    NOP
    NOP
    NOP
    NOP
LADR_0x00C2
    MOVF LRAM_0x23,W
    CALL LADR_0x000C
    MOVWF GPIO           ; !!Bank!! GPIO - TRISIO
    CALL LADR_0x00E1
    CALL LADR_0x00E1
    CALL LADR_0x00E1
    CALL LADR_0x00E1
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    RETURN
LADR_0x00E1
    MOVLW 0xFF
    MOVWF LRAM_0x22
LADR_0x00E3
    NOP
    CLRWDT
    DECFSZ LRAM_0x22,F
    GOTO LADR_0x00E3
    RETURN
LADR_0x00E8
    CLRWDT
    CALL LADR_0x0012
    GOTO LADR_0x00E8
LADR_0x00EB
    MOVLW 0x07
    MOVWF CMCON          ; !!Bank!! CMCON - VRCON
    CLRF GPIO            ; !!Bank!! GPIO - TRISIO
    BSF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    MOVLW 0x55
    MOVWF T1CON          ; !!Bank!! T1CON - OSCCAL
    MOVLW 0xCC
    MOVWF GPIO           ; !!Bank!! GPIO - TRISIO
    MOVLW 0x8B
    MOVWF TMR0           ; !!Bank!! TMR0 - OPTION_REG
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    CLRF GPIO            ; !!Bank!! GPIO - TRISIO
    CLRF LRAM_0x22
    CLRF LRAM_0x23
    CLRF LRAM_0x24
    GOTO LADR_0x00E8

    End
