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

📄 call_lib.asm

📁 C 代码C 代码C 代码C 代码C 代码C 代码C 代码C 代码C 代码C 代码
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;* Input:       none    
;* Output:      none
;*
;* Description: This function gets data which MPL needs by using callback function 
;*
;***************************************************************************
        ;extern void API_SysMPLDataProcessing(void);
        MODULE  API_SysMPLDataProcessing
        PUBLIC  API_SysMPLDataProcessing
        RSEG    APP
        DEFFN   API_SysMPLDataProcessing(0,0,0,0,32768,0,0,0)        
API_SysMPLDataProcessing:   
        
        phx
        jsr     API_data_processing
        plx
        
        rts
        ENDMOD
;.EFUNC ;API_SysMPLDataProcessing 

;***************************************************************************
;* Func:        API_SysSetAmpMode
;* Input:       AmpMode: AMP_AUTO : 0
;*                       AMP_OFF  : 1
;*                       AMP_ON   : 2
;* Output:      none
;*
;* Description: set amplifier enable/disable. if it's set AMP_AUTO, it will activate when no ear-phone plug-in.
;*
;***************************************************************************
        ;extern void API_SysSetAmpMode(uint8 AmpMode);
        MODULE  API_SysSetAmpMode
        PUBLIC  API_SysSetAmpMode
        RSEG    APP
        DEFFN   API_SysSetAmpMode(0,0,0,0,32768,0,1,0)        
API_SysSetAmpMode:   
        
        phx
        sta     par_0
        ;jsr    API_set_amp_mode
        _LOAD_API       _SA_SET_AMP_MODE,API_ID_RD_VER
        plx
        
        rts
        ENDMOD
;.EFUNC ;API_SysSetAmpMode 

;***************************************************************************
;* Func:        API_SysGetTimerSec
;* Input:       none
;*
;* Output:      timer second 
;*
;* Description: timer will increase per one second
;*
;***************************************************************************
        ;extern uint16 API_SysGetTimerSec(void);
        MODULE  API_SysGetTimerSec
        PUBLIC  API_SysGetTimerSec
        RSEG    APP
        DEFFN   API_SysGetTimerSec(0,0,0,0,32768,0,0,0)        
API_SysGetTimerSec:   
        
        LDA     tm_cnt_l
        STA     zp:-2,X
        LDA     tm_cnt_h
        STA     zp:-1,X
        
        DEX
        DEX

        RTS                             
        ENDMOD
;.EFUNC ;API_SysGetTimerSec 

;***************************************************************************
;* Func:        API_SysResetTimerSec
;* Input:       none
;*
;* Output:      none
;*
;* Description: timer will reset
;*
;***************************************************************************
        ;extern void API_SysResetTimerSec(void);
        MODULE  API_SysResetTimerSec
        PUBLIC  API_SysResetTimerSec
        RSEG    APP
        DEFFN   API_SysResetTimerSec(0,0,0,0,32768,0,0,0)        
API_SysResetTimerSec:   
        
        STZ     tm_cnt_l
        STZ     tm_cnt_h

        RTS                             
        ENDMOD
;.EFUNC ;API_SysResetTimerSec 

;***************************************************************************
;* Func:        API_LcmSetLanguage
;* Input:       language in $A
;* Output:      none
;*
;* Description: set current task
;*
;***************************************************************************
        ;extern void  API_LcmSetLanguage(uint8 CharLag);
        MODULE  API_LcmSetLanguage
        PUBLIC  API_LcmSetLanguage
        RSEG    APP
        DEFFN   API_LcmSetLanguage(0,0,0,0,32768,0,1,0) 
API_LcmSetLanguage:   
        cmp     #$ff
        beq     _exit
        sta     ch_cs    
_exit:        
        rts     
        ENDMOD
;.EFUNC ;API_LcmSetLanguage             


;***************************************************************************
;* Func:        API_LcmSetCharForm
;* Input:       ch_fs
;* Output:      none
;*
;* Description: lcm set char small/big form
;*
;***************************************************************************
        ;extern void  API_LcmSetCharForm(uint8 CharFs);
        MODULE  API_LcmSetCharForm
        PUBLIC  API_LcmSetCharForm
        RSEG    APP
        DEFFN   API_LcmSetCharForm(0,0,0,0,32768,0,1,0) 
API_LcmSetCharForm:
        sta     ch_fs   
        rts
        ENDMOD  
;.EFUNC ;API_LcmSetCharForm     

;***************************************************************************
;* Func:        API_LcmSetCharColor
;* Input:       fg_clr[h:l],bg_clrl[h:l]
;* Output:      none
;*
;* Description: lcm set char color
;*
;***************************************************************************
        ;extern void  API_LcmSetCharColor(uint16 FGClr,uint16 BGClr);
        MODULE  API_LcmSetCharColor
        PUBLIC  API_LcmSetCharColor
        RSEG    APP
        DEFFN   API_LcmSetCharColor(0,0,0,0,32768,0,4,0)        
API_LcmSetCharColor:
        lda     np:PRMBN API_LcmSetCharColor
        sta     fg_clrll
        lda     np:PRMBN API_LcmSetCharColor+1
        sta     fg_clrlh
        lda     np:PRMBN API_LcmSetCharColor+2
        sta     bg_clrll
        lda     np:PRMBN API_LcmSetCharColor+3
        sta     bg_clrlh        
        rts     
        ENDMOD
;.EFUNC ;API_LcmSetCharColor


;***************************************************************************
;* Func:        API_LcmSetStringLenth
;* Input:       str_len
;* Output:      none
;*
;* Description: lcm set string length
;*
;***************************************************************************
        ;extern void  API_LcmSetStringLenth(uint8 StrLen);
        MODULE  API_LcmSetStringLenth
        PUBLIC  API_LcmSetStringLenth
        RSEG    APP
        DEFFN   API_LcmSetStringLenth(0,0,0,0,32768,0,1,0)      
API_LcmSetStringLenth:
        sta     str_len 
        rts
        ENDMOD  
;.EFUNC ;API_LcmSetStringLenth  

        
;***************************************************************************
;* Func:        API_LcmClearScreen
;* Input:       pos_x, pos_y, w, h
;* Output:      none
;*
;* Description: lcm clear screen
;*
;***************************************************************************
        ;extern void  API_LcmClearScreen(uint16 PosX,uint16 PosY,uint16 Width,uint16 High);
        MODULE  API_LcmClearScreen
        PUBLIC  API_LcmClearScreen
        RSEG    APP
        DEFFN   API_LcmClearScreen(0,0,0,0,32768,0,8,0)
API_LcmClearScreen:
        php
                                
        lda     np:PRMBN API_LcmClearScreen     
        sta     pos_x_l
        lda     np:PRMBN API_LcmClearScreen+1
        sta     pos_x_h
        lda     np:PRMBN API_LcmClearScreen+2
        sta     pos_y_l
        lda     np:PRMBN API_LcmClearScreen+3
        sta     pos_y_h
        lda     np:PRMBN API_LcmClearScreen+4   
        sta     reg_w_l
        lda     np:PRMBN API_LcmClearScreen+5
        sta     reg_w_h
        lda     np:PRMBN API_LcmClearScreen+6
        sta     reg_h_l
        lda     np:PRMBN API_LcmClearScreen+7
        sta     reg_h_h 
        
        phx
        jsr     lcm_img_clr_region
        plx
        
        plp
        rts
        ENDMOD

;***************************************************************************
;* Func:        API_LcmShowa
;* Input:       symbol and position
;* Output:      none
;*
;* Description: lcm show debug num
;*
;***************************************************************************
        ;extern void API_LcmShowa(void);
        MODULE  API_LcmShowa
        PUBLIC  API_LcmShowa
        RSEG    APP
        DEFFN   API_LcmShowa(0,0,0,0,32768,0,0,0)
API_LcmShowa:   
        ;php
        
        ;pha    

        ;pla
        phx
        txa
        jsr     lcm_char_dbg_hex
        plx
        
        ;plp
        rts
        ENDMOD
;.EFUNC ;lcd_showa_xy_


;***************************************************************************
;* Func:        API_LcmShowNum
;* Input:       symbol and position
;* Output:      none
;*
;* Description: lcm show debug num
;*
;***************************************************************************
        ;extern void  API_LcmShowNum(uint8 Vaule);
        MODULE  API_LcmShowNum
        PUBLIC  API_LcmShowNum
        RSEG    APP
        DEFFN   API_LcmShowNum(0,0,0,0,32768,0,1,0)
API_LcmShowNum:   

        phx
        jsr     lcm_char_dbg_hex
        plx
        
        rts
        ENDMOD
;.EFUNC ;API_LcmShowNum

;***************************************************************************
;* Func:        API_LcmShowaXY
;* Input:       symbol and position
;* Output:      none
;*
;* Description: lcm show debug num
;*
;***************************************************************************
        ;extern void  API_LcmShowaXY(uint8 Vaule, uint16 PosX, uint16 PosY);
        MODULE  API_LcmShowaXY
        PUBLIC  API_LcmShowaXY
        RSEG    APP
        DEFFN   API_LcmShowaXY(0,0,0,0,32768,0,5,0)
API_LcmShowaXY: 
        ;php
        phx
        pha     
        lda     np:PRMBN API_LcmShowaXY+1
        sta     pos_x_l
        lda     np:PRMBN API_LcmShowaXY+2
        sta     pos_x_h
        lda     np:PRMBN API_LcmShowaXY+3
        sta     pos_y_l
        lda     np:PRMBN API_LcmShowaXY+4
        sta     pos_y_h
        
        pla
        jsr     lcm_char_dbg_hex
        
        ;plp
        plx
        rts
        ENDMOD
;.EFUNC ;lcd_showa_xy_

;***************************************************************************
;* Func:        API_LcmShowNumber
;* Input:       symbol and position
;* Output:      none
;*
;* Description: lcm show debug num
;*
;***************************************************************************
        ;extern void  API_LcmShowNumber(uint8 Vaule, uint16 PosX, uint16 PosY, uint8 BCD);
        MODULE  API_LcmShowNumber
        PUBLIC  API_LcmShowNumber
        RSEG    APP
        DEFFN   API_LcmShowNumber(0,0,0,0,32768,0,6,0)
API_LcmShowNumber:

        ldy     ch_cs
        phy
        
        phx
        pha
        
        lda     np:PRMBN API_LcmShowNumber+1
        sta     pos_x_l
        lda     np:PRMBN API_LcmShowNumber+2
        sta     pos_x_h
        lda     np:PRMBN API_LcmShowNumber+3
        sta     pos_y_l
        lda     np:PRMBN API_LcmShowNumber+4
        sta     pos_y_h
        
        
        lda     np:PRMBN API_LcmShowNumber+5
        bne     ?hex_to_bcd
        pla
       
;        extern EXPR_STACK 
;;abc   equ      SFE(EXPR_STACK)
;        lda    #SFE(EXPR_STACK);abc
        bra     ?_show_a
        

?hex_to_bcd:
        pla     
        ldx  #0
?hex_dec_loop0:
        cmp  #10
        bcc  ?hex_dec_ret
        sec
        sbc  #10
        inx
        jmp  ?hex_dec_loop0
?hex_dec_ret:
        sta     np:PRMBN API_LcmShowNumber+2    ;back acc np:PRMBN API_LcmShowNumber+2 is temp
        txa
        asl     a
        asl     a
        asl     a
        asl     a
        ora     np:PRMBN API_LcmShowNumber+2    
        

?_show_a:       

        pha
        ; hi-nibble
        lsr     A
        lsr     A
        lsr     A
        lsr     A
        _PUT_NIBBLE
        
        ; low-nibble
        pla
        and     #0Fh
        _PUT_NIBBLE
        
        plx
        ply
        
        sty     ch_cs
        
        rts
        ENDMOD
;.EFUNC ;API_LcmShowNumber

;***************************************************************************
;* Func:        API_LcmShowNumber2B
;* Input:       symbol and position
;* Output:      none
;*
;* Description: lcm show debug num
;*
;***************************************************************************
        ;extern void  API_LcmShowNumber2B(uint16 Vaule, uint16 PosX, uint16 PosY);
        MODULE  API_LcmShowNumber2B
        PUBLIC  API_LcmShowNumber2B
        RSEG    APP
        DEFFN   API_LcmShowNumber2B(0,0,0,0,32768,0,6,0)
API_LcmShowNumber2B:

        phx
        SETB    par_0,np:PRMBN API_LcmShowNumber2B+0
        SETB    par_1,np:PRMBN API_LcmShowNumber2B+1
        
        SETB    pos_x_l,np:PRMBN API_LcmShowNumber2B+2
        SETB    pos_x_h,np:PRMBN API_LcmShowNumber2B+3
        SETB    pos_y_l,np:PRMBN API_LcmShowNumber2B+4
        SETB    pos_y_h,np:PRMBN API_LcmShowNumber2B+5        
        
        ;jsr     API_2b_hex2bcd
        _LOAD_API       _SP_GP2_HEX2BCD,API_ID_GROUP2
        
        pha
        tya     
        
        ldy     #0
        
?_show_a:
        phy             
        pha
        ; hi-nibble
        lsr     A
        lsr     A
        lsr     A
        lsr     A
        _PUT_NIBBLE
        
        ; low-nibble
        pla
        and     #0Fh
        _PUT_NIBBLE
        ply
        

⌨️ 快捷键说明

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