⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 initcom.asm

📁 电力系统中的保护装置全部代码
💻 ASM
📖 第 1 页 / 共 2 页
字号:
    LDI    @_pInReceBuffB,AR0     ;Receive Buffer memory pointer
    STI    AR1,*AR0
    
    LDP    @_pOutReceBuffB        ;Load Data Page Pointer
    LDI    @_pOutReceBuffB,AR0    ;Receive Buffer memory pointer
    STI    AR1,*AR0      
    pop    AR1
    pop    AR0
    pop    DP  
    pop    ST
    rets 
;initial C channel      
;void   _Init_16c554C(void);    
_Init_16c554C:  
    push   ST 
    push   DP
    push   AR0 
    push   AR1
    LDP    @_Com_Port3           ;Load Data Page Pointer
    LDI    @_Com_Port3,AR0       ;LOAD in AR0 the pointer to Com_Port1

    ldi    0,AR1
    STI    AR1,*+AR0(1)           ;Mask InterruptER Register                                          ; registers 
 
    LDP    @FIFOCR                 ;Load Data Page Pointer
    LDI    @FIFOCR,AR1
    STI    AR1,*+AR0(2)            ;Init FIFOCR Register
 
    ldi    80h,AR1
    STI    AR1,*+AR0(3)           ;Line Control Register DLAB=1
 
    LDP    @DLL                   ;Load Data Page Pointer
    LDI    @DLL,AR1
    STI    AR1,*+AR0(0)           ;Init DLL Register
    LDP    @DLM                   ;Load Data Page Pointer
    LDI    @DLM,AR1
    STI    AR1,*+AR0(1)           ;Init DLM Register
    
;    LDP    @FIFOCR                ;Load Data Page Pointer
;    LDI    @FIFOCR,AR1
;    STI    AR1,*+AR0(2)           ;Init FIFOCR Register
  
    LDP    @LineCR                ;Load Data Page Pointer
    LDI    @LineCR,AR1
    STI    AR1,*+AR0(3)           ;Init Line Control Register
    LDP    @ModemCR               ;Load Data Page Pointer
    LDI    @ModemCR,AR1
    STI    AR1,*+AR0(4)           ;Init Line Control Register
    
       
    LDP    @InterruptER           ;Load Data Page Pointer
    LDI    @InterruptER,AR1
    STI    AR1,*+AR0(1)           ;Init InterruptER Register
    
    LDP    @ScratchR              ;Load Data Page Pointer
    LDI    @ScratchR,AR1
    STI    AR1,*+AR0(7)           ;Init ScratchR Register
    LDP    @_ReceiveBuffC         ;Load Data Page Pointer
    LDI    @_ReceiveBuffC,AR1     ;First address of Receive Buffer
    LDP    @_pInReceBuffC         ;Load Data Page Pointer
    LDI    @_pInReceBuffC,AR0     ;Receive Buffer memory pointer
    STI    AR1,*AR0
    
    LDP    @_pOutReceBuffC        ;Load Data Page Pointer
    LDI    @_pOutReceBuffC,AR0    ;Receive Buffer memory pointer
    STI    AR1,*AR0      
    pop    AR1
    pop    AR0   
    pop    DP  
    pop    ST
    rets 
;initial D channel      
;void   _Init_16c554D(void);   
_Init_16c554D: 
    push   ST 
    push   DP
    push   AR0 
    push   AR1
    LDP    @_Com_Port4           ;Load Data Page Pointer
    LDI    @_Com_Port4,AR0       ;LOAD in AR0 the pointer to Com_Port1

    ldi    0,AR1
    STI    AR1,*+AR0(1)           ;Mask InterruptER Register                                          ; registers 

    LDP    @FIFOCR                 ;Load Data Page Pointer
    LDI    @FIFOCR,AR1
    STI    AR1,*+AR0(2)            ;Init FIFOCR Register
 
    ldi    80h,AR1
    STI    AR1,*+AR0(3)           ;Line Control Register DLAB=1
    LDP    @DLL1                   ;Load Data Page Pointer
    LDI    @DLL1,AR1
    STI    AR1,*+AR0(0)           ;Init DLL Register
    LDP    @DLM                   ;Load Data Page Pointer
    LDI    @DLM,AR1
    STI    AR1,*+AR0(1)           ;Init DLM Register
    
;    LDP    @FIFOCR                ;Load Data Page Pointer
;    LDI    @FIFOCR,AR1
;    STI    AR1,*+AR0(2)           ;Init FIFOCR Register
  
     LDP    @LineCR1                ;Load Data Page Pointer
    LDI    @LineCR1,AR1
    STI    AR1,*+AR0(3)           ;Init Line Control Register
    
    LDP    @ModemCR               ;Load Data Page Pointer
    LDI    @ModemCR,AR1
    STI    AR1,*+AR0(4)           ;Init Line Control Register
    
       
    LDP    @InterruptER           ;Load Data Page Pointer
    LDI    @InterruptER,AR1
    STI    AR1,*+AR0(1)           ;Init InterruptER Register
    
    LDP    @ScratchR              ;Load Data Page Pointer
    LDI    @ScratchR,AR1
    STI    AR1,*+AR0(7)           ;Init ScratchR Register
 
    LDP    @_ReceiveBuffD         ;Load Data Page Pointer
    LDI    @_ReceiveBuffD,AR1     ;First address of Receive Buffer
    
    LDP    @_pInReceBuffD         ;Load Data Page Pointer
    LDI    @_pInReceBuffD,AR0     ;Receive Buffer memory pointer
    STI    AR1,*AR0
    
    LDP    @_pOutReceBuffD        ;Load Data Page Pointer
    LDI    @_pOutReceBuffD,AR0    ;Receive Buffer memory pointer
    STI    AR1,*AR0   
    pop    AR1
    pop    AR0   
    pop    DP  
    pop    ST
    rets
 ;----------------------------------------------------
;TLC16C554 receive int for GPS,PC,JK1,JK2 
_INT_EXINT3: 
        
        push   ST 
        push   DP
        push   AR0 
        push   AR1        
        push   AR2 
        PUSH   AR3
                                           ;_Int16c554_A
        LDP    @_Com_Port1                ;Load Data Page Pointer
        LDI    @_Com_Port1,AR0            ;Read Line Status Register
        ldi    *+AR0(5),AR1                ;line Status  register
        ldi    *AR0,AR3
        
        AND    _DataReady,AR1              ;receive data ready  
        CMPI   0,AR1
        bz     _Int16c554_1    
        LDP    @_pInReceBuffA              ;Load Data Page Pointer
        LDI    @_pInReceBuffA,AR2          ;Receive Buffer memory pointer
        ldi    *AR2,AR0
        
        STI    AR3,*AR0                    ;transmit receive char to buffer
        addi   1,AR0
        sti    AR0,*ar2                    ;buffer increase
               
        LDP    @_ReceiveBuffA              ;Load Data Page Pointer
        LDI    @_ReceiveBuffA,AR1          ;First address of Receive Buffer
        LDI    _ReceBuffALen_,AR3           ;Receive Buffer memory length
       
        Addi   AR1,AR3                     ;End address of Receive Buffer
        SUBI   1,AR3
        cmpi   AR0,AR3                     ;whether the end address 
        BGT    _Int16c554_1                ;No 
        sti    AR1,*AR2                    ;yes,point to the first address

_Int16c554_1:     
                                           ;_Int16c554_1  B channel
        LDP    @_Com_Port2                ;Load Data Page Pointer
        LDI    @_Com_Port2,AR0            ;Read Line Status Register
        ldi    *+AR0(5),AR1                ;line Status  register
        ldi    *AR0,AR3 
               
        AND    _DataReady,AR1              ;receive data ready  
        CMPI   0,AR1
        bz     _Int16c554_2    
        LDP    @_pInReceBuffB              ;Load Data Page Pointer
        LDI    @_pInReceBuffB,AR2          ;Receive Buffer memory pointer
        ldi    *AR2,AR0
        
        STI    AR3,*AR0                    ;transmit receive char to buffer
        addi   1,AR0
        sti    AR0,*ar2                    ;buffer increase
                              
        LDP    @_ReceiveBuffB              ;Load Data Page Pointer
        LDI    @_ReceiveBuffB,AR1          ;First address of Receive Buffer
        LDI    _ReceBuffBLen_,AR3          ;Receive Buffer memory length
       
        Addi   AR1,AR3                     ;End address of Receive Buffer
        SUBI   1,AR3
        cmpi   AR3,AR0                     ;whether the end address 
        BLT    _Int16c554_2                ;No 
        sti    AR1,*AR2                    ;yes,point to the first address
                                  
_Int16c554_2:     
                                           ;_Int16c554_2     C Channel
        LDP    @_Com_Port3                ;Load Data Page Pointer
        LDI    @_Com_Port3,AR0            ;Read Line Status Register
        ldi    *+AR0(5),AR1  
        ldi    *AR0,AR3                    ;line Status  register
       
        AND    _DataReady,AR1              ;receive data ready  
        CMPI   0,AR1
        bz     _Int16c554_3    
        LDP    @_pInReceBuffC              ;Load Data Page Pointer
        LDI    @_pInReceBuffC,AR2          ;Receive Buffer memory pointer
        ldi    *AR2,AR0
        
        STI    AR3,*AR0                    ;transmit receive char to buffer
        addi   1,AR0
        sti    AR0,*ar2                    ;buffer increase
                              
        LDP    @_ReceiveBuffC              ;Load Data Page Pointer
        LDI    @_ReceiveBuffC,AR1          ;First address of Receive Buffer
        LDI    _ReceBuffCLen_,AR3           ;Receive Buffer memory length
       
        Addi   AR1,AR3                     ;End address of Receive Buffer
        SUBI   1,AR3
        cmpi   AR3,AR0                     ;whether the end address 
        BLT    _Int16c554_3                ;No 
        sti    AR1,*AR2                    ;yes,point to the first address
                                   
_Int16c554_3:   
                                           ;D channel
        LDP    @_Com_Port4                ;Load Data Page Pointer
        LDI    @_Com_Port4,AR0            ;Read Line Status Register
        ldi    *+AR0(5),AR1  
        ldi    *AR0,AR3                    ;line Status  register
       
        AND    _DataReady,AR1              ;receive data ready  
        CMPI   0,AR1
        bz     _Int16c554_4    
        LDP    @_pInReceBuffD              ;Load Data Page Pointer
        LDI    @_pInReceBuffD,AR2          ;Receive Buffer memory pointer
        ldi    *AR2,AR0
        
        STI    AR3,*AR0                    ;transmit receive char to buffer
        addi   1,AR0
        sti    AR0,*ar2                    ;buffer increase

        LDP    @_ReceiveBuffD              ;Load Data Page Pointer
        LDI    @_ReceiveBuffD,AR1          ;First address of Receive Buffer
        LDI    _ReceBuffDLen_,AR3           ;Receive Buffer memory length
        Addi   AR1,AR3                     ;End address of Receive Buffer
        SUBI   1,AR3
        cmpi   AR3,AR0                     ;whether the end address 
        BLT    _Int16c554_4                ;No 
        sti    AR1,*AR2                    ;yes,point to the first address
_Int16c554_4:   
        POP    AR3 
        pop    AR2
        pop    AR1
        pop    AR0
        pop    DP  
        pop    ST
        reti
;---------------------------------------------------        
       .end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -