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

📄 cal.asm

📁 辞典 dict3.asm.grammar.asm,newword.asm 学习 learn.asm 名片 userinf.asm 备忘 userinf.asm 提醒 userinf
💻 ASM
字号:
; ***************************************************************************
; *     Project : Electronic Dictionary                                     *
; *        Date : 2003.9                                                    *
; *   File Name : CAL.ASM                                                   *
; ***************************************************************************

        pw      128
        case    off
        externs on
        include ST2202.def
        include ST2202.mac
        include Data.def        ; Data RAM define.
        include KeyDef.def
        include Bios.h
        include Graphics.h
        include Graph.def
        include exchange.h

        public  cal_Load
        public  system_init_cal
        public  CalculatorEvent
        public  check_cal_checksum_data
DigN    equ     12
dp_min  equ     2
;============================================================
;;K0Key   equ     QuesKey         ; '0'
;;K1Key   equ     BKey            ; '1'
;;K2Key   equ     NKey            ; '2'
;;K3Key   equ     MKey            ; '3'
;;K4Key   equ     GKey            ; '4'
;;K5Key   equ     HKey            ; '5'
;;K6Key   equ     JKey            ; '6'
;;K7Key   equ     TKey            ; '7'
;;K8Key   equ     YKey            ; '8'
;;K9Key   equ     UKey            ; '9'
;;PotKey  equ     PointKey        ; '.'
;;AddKey  equ     DownKey         ; '+'
;;MinKey  equ     UpKey           ; '-'
;;MulKey  equ     lKey            ; '*'
;;DivKey  equ     oKey            ; '/'
;;PersKey equ     Rkey            ; '%'
;;PMKey   equ     FKey            ; '+/-'
;;EquKey  equ     SpaceKey        ; '='
;;MAdKey  equ     RightKey        ; 'M+'
;;MSbKey  equ     PgDown          ; 'M-'
;;MRKey   equ     EnterKey        ; 'MR' key.
;;MCKey   equ     PKey            ; 'MC' key.
;;CEKey   equ     VKey            ; C/CE
;;ACKey   equ     LanKey          ; AC

K0Key   equ     QuesKey         ; '0'
K1Key   equ     BKey            ; '1'
K2Key   equ     NKey            ; '2'
K3Key   equ     MKey            ; '3'
K4Key   equ     GKey            ; '4'
K5Key   equ     HKey            ; '5'
K6Key   equ     JKey            ; '6'
K7Key   equ     TKey            ; '7'
K8Key   equ     YKey            ; '8'
K9Key   equ     UKey            ; '9'
PotKey  equ     PointKey        ; '.'
AddKey  equ     UPKey           ; '+'
MinKey  equ     DOWNKey         ; '-'
MulKey  equ     LEFTKey         ; '*'
DivKey  equ     RIGHTKey        ; '/'
PersKey equ     Rkey            ; '%'
PMKey   equ     FKey            ; '+/-'
EquKey  equ     spaceKey        ; '='
MAdKey  equ     LKey            ; 'M+'
MSbKey  equ     OKEY            ; 'M-'
MRKey   equ     KKey            ; 'MR' key.
MCKey   equ     IKey            ; 'MC' key.
CEKey   equ     VKey            ; C/CEZZ
;ACKey   equ     ACKey           ; AC
;=====================================================
ClrOpredF macro
        rmb3    <OprL           ;将OprL.3 清'0'
        endm

BrNOpredF macro BrNOpredFLab
        bbr3    <OprL,BrNOpredFLab  ;if(OprL.3 =='0')  goto BrNOpredFLab ;
        endm

BrOpredF macro BrOpredFLab
        bbs3    <OprL,BrOpredFLab    ;if(OprL.3 =='1')  goto BrOpredFLab ;
        endm

SetError  macro                 ; Error flag =1.
        smb7    <CalF           ; 置'1'CalF.7
        endm

ClrError  macro                 ; Error flag =0.
        rmb7    <CalF           ; 清'0'CalF.7
        endm

BrErr   macro   BrErrLab
        bbs7    <CalF,BrErrLab  ; 如果calf.7==1  goto BrErrLab ;
        endm

BrNErr  macro   BrNErrLab
        bbr7    <CalF,BrNErrLab ; 如果calf.7==0  goto BrNErrLab;
        endm

BrNumKi macro   BrNumKiLab
        bbs6    <CalF,BrNumKiLab ; 如果calf.6==1  goto BrNumKiLab ;
        endm

BrNNumKi macro   BrNNumKiLab
        bbr6    <CalF,BrNNumKiLab ; 如果calf.6==0  goto BrNNumKiLab ;
        endm

SetNumKiF macro                 ; NumKiF
        smb6    <CalF           ; 置'1' calf.6
        endm

ClrNumKiF macro                 ; NumKiF
        rmb6    <CalF           ;清'0' calf.6
        endm
BrNPtedF macro BrNPtedFLab      ; Branch if PtedF==0.
        bbr5    <CalF,BrNPtedFLab  ;if(calf.5==0)  goto ..
        endm

SetPtedF macro                  ; PtedF = 1.
        smb5    <CalF           ;if(calf.5==1)  goto ..
        endm

ClrPtedF macro                  ; PtedF = 0.
        rmb5    <CalF           ;清'0'calf.5
        endm

SetPersF macro
        smb4    <CalF           ;置'1' calf.4
        endm

ClrPersF macro
        rmb4    <CalF           ;清'0' calf.4
        endm

BrPersF macro   BrPersFLab
        bbs4    <CalF,BrPersFLab ;if(calf.4==1)  goto ..
        endm

BrNPersF macro  BrNPersFLab
        bbr4    <CalF,BrNPersFLab ;if(calf.4==0)  goto ..
        endm

ClrMRCF macro
        rmb3    <CalF           ;清'0'calf.3
        endm
SetMRF  macro
        smb0    <OperF          ; 置'1' operf.0
        endm
ClrMRF  macro
        rmb0    <OperF          ; 清'0' operf.0
        endm
BrMRF   macro   jmrflab
        bbs0    <OperF,jmrflab ;if(operf.0 == 1)  goto ..
        endm
SetBMinus macro
        smb7    <num_disp_sign         ;置'1' datax_sign.7
        endm

ClrBMinus macro
        rmb7    <num_disp_sign         ;清'0' datax_sign.7
        endm

;=====================================================
otherflag       equ     ZData+0
Opr             equ     ZData+1
OprL            equ     ZData+2
CalF            equ     ZData+3
Cry             equ     ZData+4
MemOpF          equ     ZData+5
OperF           equ     ZData+6
M_bak_sign      equ     ZData+7
b_bak_sign      equ     ZData+15
num_int_sign    equ     ZData+31
num_disp_sign   equ     ZData+39
WFg             equ     ZData+47
cal_disp_fg     equ     ZData+55

;=====================================================
cal_disp_dp     equ     cal_disp_fg+1
cal_disp_b0     equ     cal_disp_fg+2
cal_disp_b3b2   equ     cal_disp_fg+3

num_disp_dp     equ     num_disp_sign+1
num_disp_b1b0   equ     num_disp_sign+2
num_disp_b11b10 equ     num_disp_sign+7

num_int_dp      equ     num_int_sign+1
num_int_b1b0    equ     num_int_sign+2
num_int_b11b10  equ     num_int_sign+7

MDP             equ     MFg+1
M0              equ     MFg+2

WDP             equ     WFg+1
WK0             equ     WFg+2
WK11            equ     WFg+7

; Operation number "W"
screen_flag  equ   600h
special_ram  equ   601h
;;error_ram    equ   602h
equ_flag     equ   603h
;=====================================================
;=====================================================
;       Event vector table.
DS0     .SECTION
	include	caclbmp.asm

cal_checksum_data:
        db      'scical',0
;=====================================================
CalculatorEvent:
        dw      Cal_Bank        ;

        dw      cal_HSec-1         ; 半秒钟事件处理程式向量
        dw      cal_Sec-1          ; 一秒钟事件处理程式向量
        dw      cal_Min-1          ; 一分钟事件处理程式向量
        dw      cal_KeyDown-1      ; cal_key_down处理程式向量(主程式从这里进入)
        dw      cal_KeyUp-1        ; Key Up 事件处理程式向量
        dw      cal_Timer-1        ; Timer 事件处理程式向量
        dw      cal_KeyPress-1     ; 键一直按住不放手
        dw      cal_Load-1         ; 进入此 Mode 事件处理程式向量

⌨️ 快捷键说明

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