📄 main.asm
字号:
not_ic_key:
main_loop_no_check_rt:
ld wa,F_CALER
test (F_CALER>>4).a ;bit -reverse-> jump status
j f,error_recov ;if jump status is 0 -> branch
;V3.00 @BBS (RTC_ON,rtc_key) ;RTC display mode? yes ->check entry key code and jump to each function
ld wa,F_RATE
test (F_RATE>>4).a ;bit -reverse-> jump status
j t,main_kj0 ;if jump status is 1 -> branch
call obs_key_check
j cs,main_loop
;calculate each key function routin jump address.....
main_kj0:
ld a,(KEYIN)
ld c,0
cmp a,K_TEN ;if key code is Tenkey,00 or 000?
j le,main_kj2 ;yes ->
sub a,K_TEN ;for get function routine jump address
shlc a
ld c,a ;reg.c <- table offset
main_kj2:
ld hl,tbl_function ;get jump address
j (hl+c) ;jump to each function routine
;===============================================================================
; Exit of function routine
;===============================================================================
function_end:
cmp (KEYIN),K_RATE ;V1.04
j eq,function_end_0 ;V1.04
ld wa,F_RATE
clr (F_RATE>>4).a
ld wa,RATE_PROG
clr (RATE_PROG>>4).a
ld wa,EURO_PROG
clr (EURO_PROG>>4).a
function_end_0: ;V1.04
ld (TEN_CT),0 ;
ld (DT_CT),0 ;#/D entry counter
ld (DT_DOT_CNT),0 ;
ld (DT_CHR_CNT),0 ;
ld wa,F_DPIN
clr (F_DPIN>>4).a
ld wa,F_MIN_TRA
clr (F_MIN_TRA>>4).a
;entry point for tenkey.................................
tenkey_end:
ld a,(KEYIN)
ld (PRE_KEY),a ;save current key code -> PRE_KEY
cmp (KEYIN),K_RATE ;V1.13
j eq,shp_sgn_end ;V1.13
ld wa,RATE_PROG
test (RATE_PROG>>4).a ;bit -reverse-> jump status
j f,shp_sgn_end ;if jump status is 0 -> branch
ld wa,F_RATE
clr (F_RATE>>4).a
;entry point for # key and +/- key......................
shp_sgn_end:
call kychk_clcsm ;check function key whether clear C-S-M flags
cmp (KEYIN),K_DP ;V1.07
j le,functionnoclearftenkey ;V1.07
cmp (KEYIN),K_BS ;V1.24
j eq,functionnoclearftenkey ;V1.24
cmp (KEYIN),K_SGN ;V1.36
j eq,functionnoclearftenkey ;V1.36
ld wa,F_TNKEY
clr (F_TNKEY>>4).a
functionnoclearftenkey: ;V1.07
;/TEST call keychk_amortize ;V1.09
ld wa,EURO_DISPLY
clr (EURO_DISPLY>>4).a
;entry point for FEED key(just check printer error)......................
feed_key_end:
ld wa,P_ERR
test (P_ERR>>4).a ;bit -reverse-> jump status
j f,sys_error ;if jump status is 0 -> branch
ld wa,F_CALER
test (F_CALER>>4).a ;bit -reverse-> jump status
j f,sys_error ;if jump status is 0 -> branch
function_end9:
ld wa,F_TNKEY
test (F_TNKEY>>4).a ;bit -reverse-> jump status
j f,function_end91 ;if jump status is 0 -> branch
;V3.00 @BBS (RTC_ON,no_operation)
function_end91: ;V1.23
ld hl,TENKEY
;V4.13 @BBC (F_ICDSP,function_not_isdsp) ;V1.23
;V4.13 call ic_display ;V1.23
;V4.13 jp function_end99
function_not_isdsp: ;V1.23
call vft_disable ;V2.10
call edit_disp
function_end99:
call disp_to_dbr ;DBR update (DISP -> DBR)
cmp (KEYIN),K_TAX ;V2.07
j eq,no_operation ;V2.07
;V4.13 @CLB (M_TX1) ;V2.07
;V4.13 @CLB (M_TX2) ;V2.07
no_operation: ;V2.07
;V2.05 call vft_enable ;V2.01
ld wa,F_DOFF
clr (F_DOFF>>4).a
ld wa,F_REVCAN
clr (F_REVCAN>>4).a
j main_loop
;==============================================================================
ic_display: ;--------V1.23
;V4.13 call spc_disp
;V4.13 @CLB (ICON_MIN) ;V1.48
;V1.39c ld a,(IC_BK)
;V4.13 ld a,(IC_BK+1) ;V1.39c
;V4.13 and a,0x0f
;V4.13 ld (DISP_LSD),a
;V1.39c ld a,(IC_BK)
;V4.13 ld a,(IC_BK+1) ;V1.39c
;V4.03 shrc a
;V4.03 shrc a
;V4.03 shrc a
;V4.03 shrc a
;V4.13 swap a ;V4.03
;V4.13 and a,0x0f ;V4.03
;V4.13 ld (DISP_LSD-1),a
;V1.39c ld a,(IC_BK+1)
;V4.13 ld a,(IC_BK) ;V1.39c
;V4.13 and a,0x0f
;V4.13 ld (DISP_LSD-2),a
;V4.13 ld (DISP_LSD-3),D_Uo
;V4.13 @BBC (SW_ICPM_RT,icp_disp)
;V4.13 ld (DISP_LSD-3),D_Lo
icp_disp:
ret
;-------------------------------------------
;==========================================
model_select:
ld a,(P0DR)
and a,0y00000011
nop ;V4.02
nop
nop
nop
nop
nop
nop
ld b,(P0DR)
and b,0y00000011
cmp a,b
j ne,model_select
ld (FLG_MODE),a
model_select_1: ;V4.02
ld a,(P3PRD) ;V4.02
and a,0y00000010 ;V4.02
nop ;V4.02
nop ;V4.02
nop ;V4.02
nop ;V4.02
nop ;V4.02
ld b,(P3PRD) ;V4.02
and b,0y00000010 ;V4.02
cmp a,b ;V4.02
j ne,model_select_1 ;V4.02
shlc a ;V4.02
or a,(FLG_MODE) ;V4.02
ld (FLG_MODE),a ;V4.02
test a.2
j t,model_select_2
ld wa,M_FX_M14
set (M_FX_M14>>4).a
model_select_2:
ld wa,M_FX_SGM
set (M_FX_SGM>>4).a
ld wa,M_FX_AC
set (M_FX_AC>>4).a
ret
;===============================================================================
init_all_rate:
call ee_to_tax
call tax_to_w2
call w2_to_ten
call keep_ten_6dig
call ten_to_w2
call w2_to_tax
call ee_to_tax2
call tax2_to_w2
call w2_to_ten
call keep_ten_6dig
call ten_to_w2
call w2_to_tax2
call ee_country_read
ld a,(COUNTRY1)
cmp a,12
j lt,init_all_rate_1
clr cf
sub a,12
call ee_to_euro1
jp init_all_rate_10
init_all_rate_1:
ld (COUNTRY_TEN),a
call fix_euro_to_ten
call ten_to_euro1
init_all_rate_10:
ld a,(COUNTRY2)
cmp a,12
j lt,init_all_rate_2
clr cf
sub a,12
call ee_to_euro2
jp init_all_rate_20
init_all_rate_2:
ld (COUNTRY_TEN),a
call fix_euro_to_ten
call ten_to_euro2
init_all_rate_20:
call ten_clear
ret
;===============================================================================
check_perexe_flag_clearornot:
cmp (KEYIN),K_DP
j le,check_perexe_flag_clearornot_end
cmp (KEYIN),K_BS
j eq,check_perexe_flag_clearornot_end
cmp (KEYIN),K_SGN
j eq,check_perexe_flag_clearornot_end
cmp (KEYIN),K_TL
j eq,check_perexe_flag_clearornot_end
cmp (KEYIN),K_PLS
j eq,check_perexe_flag_clearornot_end
cmp (KEYIN),K_MIN
j eq,check_perexe_flag_clearornot_end
cmp (KEYIN),K_MPL
j eq,check_perexe_flag_clearornot_end
cmp (KEYIN),K_MMI
j eq,check_perexe_flag_clearornot_end
ld wa,SW_M2
test (SW_M2>>4).a ;bit -reverse-> jump status
j f,check_perexe_flag_clearornot_8 ;if jump status is 0 -> branch
ld wa,F_M2CAL
test (F_M2CAL>>4).a ;bit -reverse-> jump status
j t,check_perexe_flag_clearornot_9 ;if jump status is 1 -> branch
check_perexe_flag_clearornot_8:
;V4.12 cmp (KEYIN),K_M2PL
;V4.12 j eq,check_perexe_flag_clearornot_end
;V4.12 cmp (KEYIN),K_M2MI
;V4.12 j eq,check_perexe_flag_clearornot_end
check_perexe_flag_clearornot_9:
ld wa,F_PEREXE
clr (F_PEREXE>>4).a
check_perexe_flag_clearornot_end:
ret
;===============================================================================
; System error
;===============================================================================
sys_error:
;V1.09 @BBS (ERR_MES,function_end9) ;already print error message yes-> skip print
ld wa,ICON_E
set (ICON_E>>4).a
ld wa,P_ERR
test (P_ERR>>4).a ;bit -reverse-> jump status
j f,sys_errpe1 ;if jump status is 0 -> branch
call err_print
ld hl,W1
call wk_print
call w1_to_ten
sys_errpe:
call feed_1
sys_errpe1: ;V1.39a
;V3.00 call ten_clear ;display '0'
cmp (KEYIN),K_PERPLS
j ne,sys_errpe2
ld hl,IC_A
ld (SYM),S_SPC ;V1.24
call ic_print
call acc_to_ten
ld hl,TENKEY
ld (SYM),S_ST
call wk_print
call feed_1
sys_errpe2:
j function_end9
;===============================================================================
; Error recovery
;===============================================================================
error_recov:
cmp (KEYIN),K_BS
j ne,error_recov_x ;V4.07
;V4.12 @BBS (F_COUNTRY,error_bs) ;V4.12
;V4.12 @BBS (F_RATE,no_operation) ;V4.07
ld wa,F_RATE
test (F_RATE>>4).a ;bit -reverse-> jump status
j f,error_rec_bs ;if jump status is 0 -> branch
ld (PRE_KEY),0xff ;V4.12
j error_rcv3 ;V4.12
;V4.12 jp error_bs_1 ;V4.12
error_rec_bs: ;v4.12
ld wa,EURO_PROG
test (EURO_PROG>>4).a ;bit -reverse-> jump status
j t,error_bs ;if jump status is 1 -> branch
jp no_operation ;V4.12
error_bs: ;V4.12
cmp (PRE_KEY),K_RATE ;V4.17
j eq,error_bs_0 ;V4.17
cmp (PRE_KEY),K_EQU ;V4.12
j eq,error_bs_0 ;V4.12
cmp (PRE_KEY),K_EURO ;V4.12a
j eq,error_bs_0 ;V4.12a
cmp (PRE_KEY),K_LOCAL ;V4.12a
j eq,error_bs_0 ;V4.12a
ld wa,F_COUNTRY
test (F_COUNTRY>>4).a ;bit -reverse-> jump status
j f,error_bs_0 ;if jump status is 0 -> branch
CMP (COUNTRY_TEN),17 ;V4.12
j ge,no_operation ;V4.12 ;V4.12
ld wa,F_TNKEY
test (F_TNKEY>>4).a ;bit -reverse-> jump status
j t,error_bs_0 ;if jump status is 1 -> branch
cmp (COUNTRY_TEN),12 ;V4.12
j lt,no_operation ;V4.12
error_bs_0: ;V4.12
ld wa,F_RATE
clr (F_RATE>>4).a
error_bs_1: ;V4.12
ld wa,F_COUNTRY
clr (F_COUNTRY>>4).a
call error_clr ;V4.10
ld wa,F_TNKEY
test (F_TNKEY>>4).a ;bit -reverse-> jump status
j f,error_bs_2 ;if jump status is 0 -> branch
call ten_clear ;V4.12
error_bs_2: ;V4.12
ld wa,F_TNKEY
clr (F_TNKEY>>4).a
ld wa,F_DPIN
clr (F_DPIN>>4).a
ld wa,F_MIN_TRA
clr (F_MIN_TRA>>4).a
ld wa,EURO_DISPLY
set (EURO_DISPLY>>4).a
ld (TEN_CT),0 ;V4.10
ld (DT_CT),0 ;V4.10
ld (DT_DOT_CNT),0 ;V4.10
ld (DT_CHR_CNT),0 ;V4.10
j function_end99 ;V4.10
;V4.10 j error_rcv3
error_recov_x:
cmp (KEYIN),K_CE ;V1.24;-> recovery (clear 'E' icon only)
j eq,error_rcv2 ;V1.24
cmp (KEYIN),K_CEC
j eq,error_rcv1 ;-> recovery (clear 'E' display '0')
j no_operation
;CEC key.......
error_rcv1:
ld wa,P_ERR
test (P_ERR>>4).a ;bit -reverse-> jump status
j f,error_rcv10 ;if jump status is 0 -> branch
ld wa,SW_AC
test (SW_AC>>4).a ;bit -reverse-> jump status
j t,error_rcv2 ;if jump status is 1 -> branch
error_rcv10:
ld (FLG_E),0 ;V1.13
ld (FLG_C),0 ;V1.13
ld wa,P_ERR
test (P_ERR>>4).a ;bit -reverse-> jump status
j f,error_rcvpe ;if jump status is 0 -> branch
call error_clr ;clear F_ZDIVER, F_CALER, ICON_E
j cec_key
;V4.12 @CLB (MEQ_ENB) ;not allow M+= or M-= calculation even having multi/div entry before
error_rcv2:
ld wa,F_COUNTRY
clr (F_COUNTRY>>4).a
test (FLG_MODE).2
j t,error_rcv2_1
and (FLG_E),0x0f ;V4.12
and (FLG_C),0x0f ;V4.12
error_rcv2_1: ;V4.12
;V3.04 ld (FLG_E),0 ;V1.32
;V3.04 ld (FLG_C),0 ;V1.32
ld wa,P_ERR
test (P_ERR>>4).a ;bit -reverse-> jump status
j f,no_operation ;if jump status is 0 -> branch
call ten_clear ;V1.30
;V1.30 @SEB (ERR_CLR) ;set just after clear calculation error flag for chain multi/div function
error_rcv3:
call error_clr ;V1.30
error_rcv29:
j function_end ;
error_rcvpe:
call all_clear ;h/w initialize, work area clear, interrupt enable
ld wa,ICON_E
clr (ICON_E>>4).a
ld wa,P_ERR
clr (P_ERR>>4).a
ld wa,F_COUNTRY
clr (F_COUNTRY>>4).a
call error_clr ;V1.37
call spc_prnbuf ;V1.37
ld (PRN_BUF_LSD-1),ps_0 ;v4.03
ld (PRN_BUF_LSD),ps_dot ;V4.03 "0." print out V1.37
ld (PRN_BUF_SYM),S_CLR ;V4.03 'C ';V1.37
test (FLG_MODE).0
j t,error_rcvpe_1
ld (PRN_BUF_LSD_LTP-1),ps_0 ;V4.03
ld (PRN_BUF_LSD_LTP),ps_dot ;V4.03 "0." print out
ld (PRN_BUF_SYM_LTP),S_CLR ;V4.03 'C ';V1.37
error_rcvpe_1: ;V4.03
call print_bk ;V1.37
;V1.37 call wkup_print ;V1.09 initial print
call feed_1 ;V1.31
;V1.09 call prn_init ;printer initialize
j error_rcv29
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -