📄 business_fn.asm
字号:
keep_ten_6dig:
ld (TEN_CT),14
ld c,1
ld hl,TENKEY
keep_ten_6dig_x:
ld a,(hl+c)
and a,0xf0
j ne,keep_ten_6dig_0
dec (TEN_CT)
ld a,(hl+OFF_DP)
cmp a,(TEN_CT)
j ge,keep_ten_6dig_0
ld a,(hl+c)
and a,0x0f
j ne,keep_ten_6dig_0
dec (TEN_CT)
ld a,(hl+OFF_DP)
cmp a,(TEN_CT)
j ge,keep_ten_6dig_0
inc c
cmp c,8
j ge,keep_ten_6dig_0
jp keep_ten_6dig_x
keep_ten_6dig_0:
cmp (TEN_CT),6
j lt,to_inc_ten_digit
to_dec_ten_digit:
cmp (TEN_CT),7
j lt,keep_ten_6dig_end
j gt,to_dec_ten_digit_1
cmp (TEN_DP),6
j ne,to_dec_ten_digit_1
ld hl,TENKEY+1
call test_zero_before_dp
j cc,keep_ten_6dig_end
to_dec_ten_digit_1:
ld hl,TENKEY
call stg_sfr47
dec (TENKEY+8)
dec (TEN_CT)
j gt,to_dec_ten_digit
to_inc_ten_digit:
cmp (TEN_CT),6
j ge,keep_ten_6dig_end
ld hl,TENKEY
call stg_sfl47
inc (TENKEY+8)
inc (TEN_CT)
j to_inc_ten_digit
keep_ten_6dig_end:
ret
;-----------------------------------------
test_zero_before_dp:
ld c,0
ld w,14
test_zero_before_dp_s:
ld a,(hl+c)
and a,0xf0
j ne,test_zero_before_dp_1
dec w
cmp w,(hl+OFF_DP-1)
j eq,test_zero_before_dp_0
ld a,(hl+c)
and a,0x0f
j ne,test_zero_before_dp_1
dec w
cmp w,(hl+OFF_DP-1)
j eq,test_zero_before_dp_0
inc c
jp test_zero_before_dp_s
test_zero_before_dp_0:
clr cf
ret
test_zero_before_dp_1:
set cf
ret
;-----------------------------------------
;V2.08
check_dp_over_slid:
ld a,(hl+OFF_DP)
cmp a,(DP_POS)
check_dp_over_slid_0:
j ge,check_dp_over_slid_end
ld d,(hl+OFF_MSD)
ld wa,M14
test (M14>>4).a ;bit -reverse-> jump status
j f,check_dp_over_slid_1 ;if jump status is 0 -> branch
ld d,(hl+OFF_MSD12) ;V1.21
ld wa,M10
test (M10>>4).a ;bit -reverse-> jump status
j t,check_dp_over_slid_1 ;if jump status is 1 -> branch
ld d,(hl+OFF_MSD10) ;V1.21
check_dp_over_slid_1: ;V1.21
and d,0xf0
j nz,check_dp_over_slid_end
inc (hl+OFF_DP)
call stg_sfl47
jp check_dp_over_slid
check_dp_over_slid_end:
ret
;V2.08
;=================================
check_dp_over2:
cmp (hl+OFF_DP),2
check_dp_over2_0:
j ge,check_dp_over2_end
ld d,(hl+OFF_MSD)
ld wa,M14
test (M14>>4).a ;bit -reverse-> jump status
j f,check_dp_over2_1 ;if jump status is 0 -> branch
ld d,(hl+OFF_MSD12) ;V1.21
ld wa,M10
test (M10>>4).a ;bit -reverse-> jump status
j t,check_dp_over2_1 ;if jump status is 1 -> branch
ld d,(hl+OFF_MSD10) ;V1.21
check_dp_over2_1: ;V1.21
and d,0xf0
j nz,check_dp_over2_end
inc (hl+OFF_DP)
call stg_sfl47
jp check_dp_over2
check_dp_over2_end:
ret
keep_2dp:
ld a,(DP_POS)
push a
ld (DP_POS),2
call wk_round_0
pop a
ld (DP_POS),a
ret
;V2.06-----------------------------
fix_round_down_keep_2dp:
ld a,(MDFLG_1) ;V2.06 keep round flag
push a ;v2.06
ld wa,SW_RNDUP
clr (SW_RNDUP>>4).a
ld wa,SW_RND54
clr (SW_RND54>>4).a
call keep_2dp
pop a ;V2.06
ld (MDFLG_1),a ;V2.06 restore round flag
ret
fix_round_up_keep_2dp:
ld a,(MDFLG_1) ;V2.06 keep round flag
push a ;v2.06
ld wa,SW_RNDUP
set (SW_RNDUP>>4).a
ld wa,SW_RND54
clr (SW_RND54>>4).a
call keep_2dp
pop a ;V2.06
ld (MDFLG_1),a ;V2.06 restore round flag
ret
;V2.06---------------------------------------
tax_mark_print:
;V3.00 @BBS (SW_V15,tax_mark_print_0) ;V2.07
ret ;V2.07
;V3.00tax_mark_print_0: ;V2.07
;V3.00 call spc_prnbuf
;V3.00 ld hl,PRN_BUF
;V3.00 ld a,0xcc
;V3.00 ld c,7
;V3.00 whic_tax_print_1:
;V3.00 ld (hl+c),a
;V3.00 dec c
;V3.00 cmp c,3
;V3.00 j f,whic_tax_print_1
;V3.00 ld a,0xfc ;only"." at right side
;V3.00 ld (hl+c),a
;V3.00 ld (PRN_BUF_SYM),S_SPC
;V3.00 ld (PRN_BUF+5),0xc1 ;for set_tax1_mark_print:
;V3.00 @BBC (M_TX2,whic_tax_print_end)
;V3.00 @BBC (M_TX1,to_tax2_mark_print) ;V2.07
;V3.00 ld (PRN_BUF+5),0x1b ;V2.07 '1,'
;V3.00 ld (PRN_BUF+6),0x2c ;V2.07 '2.'
;V3.00 jp whic_tax_print_end ;V2.07
;V3.00to_tax2_mark_print: ;V2.07
;V3.00 ld (PRN_BUF+5),0xc2 ;for set_tax2_mark_print:
;V3.00whic_tax_print_end:
;V3.00 call print_bk
;V3.00 ret
;----------------------------------------------------V2.06
;===============================================================================
tax2_plus:
;V4.11 @SEB (M_TX2)
;V3.00 @BBC (SW_V15,tax2_plus_x) ;v1.19\
;V3.00 ld (KEYIN),K_TAX ;V1.19|wait for acc_plus or acc_minus
;V3.00 @BBS (F_RATE,tax_plus_0) ;V1.20
;V3.00 jp tax_min91 ;V1.19/
tax2_plus_x: ;V1.19
jp tax_plus_a ;V1.17
;===============================================================================
; TAX+
;===============================================================================
tax_plus:
;V3.00 @BBC (SW_V15,tax_plus_x) ;V1.19\
;V3.00 @SEB (M_TX1) ;V2.07|
;V3.00 ld (KEYIN),K_TAX ;V1.19|will wait for [+] or [-] to perform [TAX+] or [TAX-]
;V3.00 @BBS (F_RATE,tax_plus_0) ;V1.20|--> is recall or set rate?
;V3.00 jp tax_min91 ;V1.19/
;V4.17 @IS_5514_OFF(tax_plus_x) ;V4.12
test (FLG_MODE).2
j f,tax_plus_x
ld wa,F_TNKEY
test (F_TNKEY>>4).a ;bit -reverse-> jump status
j f,tax_plus_x ;if jump status is 0 -> branch
ld a,(FLG_E) ;V4.12
and a,0y00000011 ;V4.12
j ne,no_operation ;V4.12
tax_plus_x:
ld wa,F_REVCAN
set (F_REVCAN>>4).a
ld wa,SW_EUTX
test (SW_EUTX>>4).a ;bit -reverse-> jump status
j t,tax_plus_a ;if jump status is 1 -> branch
ld (KEYIN),K_EURO ;need to perform euro logic?
jp euro_key_start
tax_plus_a:
ld wa,F_RATE
test (F_RATE>>4).a ;bit -reverse-> jump status
j f,tax_plus_0 ;if jump status is 0 -> branch
tax_plus_y: ;V1.09\
call tax_equ
ld wa,F_CALER
test (F_CALER>>4).a ;bit -reverse-> jump status
j f,tax_equ_end ;if jump status is 0 -> branch
j cs,no_operation
call ten_to_w2dp ;V1.15|ten buffer write into W2
cmp (PRE_KEY),K_TXM ;V1.15\
j eq,tax_min00 ;V1.15/yes, jump to-->
jp tax_minus_yuan
;=================================================================================
;rate setting or rate recall
tax_plus_0:
test (FLG_MODE).2
j f,tax_plus_0x
ld wa,EURO_PROG
test (EURO_PROG>>4).a ;bit -reverse-> jump status
j f,tax_plus_01 ;if jump status is 0 -> branch
tax_plus_0x: ;V4.12
ld wa,F_TNKEY
test (F_TNKEY>>4).a ;bit -reverse-> jump status
j t,tax_plus_01 ;if jump status is 1 -> branch
ld (KEYIN),0xff ;V1.13| is rate setting?
jp tax_plus_1 ;V1.13/
tax_plus_01: ;V1.13
call tax_recall
jp tax_plus_2
tax_plus_1: ;------------------------------------------tax rate set
call tax_save
tax_plus_2:
ld wa,RATE_PROG
clr (RATE_PROG>>4).a
ld wa,EURO_PROG
clr (EURO_PROG>>4).a
ld wa,F_RATE
clr (F_RATE>>4).a
ld wa,F_TNKEY
clr (F_TNKEY>>4).a
ld wa,F_DPIN
clr (F_DPIN>>4).a
ld (TEN_CT),0 ;
ld (DT_CT),0 ;
ld (DT_DOT_CNT),0 ;
ld (DT_CHR_CNT),0 ;
ld a,(FLG_C)
and a,0y00000000
ld (FLG_C),a
ld a,(FLG_E) ;clear all calculate instruction flags except E_MUP,E_MUL,E_DIV
and a,0y00001111
ld (FLG_E),a
jp no_operation
;==============================================================================
tax2_minus:
;V4.13 @SEB (M_TX2)
;V4.13 jp tax_minus_a ;V2.17
;===============================================================================
; TAX-
;===============================================================================
tax_minus:
;V4.17 @IS_5514_OFF(tax_minus_x) ;V4.12
test (FLG_MODE).2
j f,tax_minus_x
ld wa,F_TNKEY
test (F_TNKEY>>4).a ;bit -reverse-> jump status
j f,tax_minus_x ;if jump status is 0 -> branch
ld a,(FLG_E) ;V4.12
and a,0y00000011 ;V4.12
j ne,no_operation ;V4.12
tax_minus_x:
ld wa,F_REVCAN
set (F_REVCAN>>4).a
ld wa,SW_EUTX
test (SW_EUTX>>4).a ;bit -reverse-> jump status
j t,tax_minus_a ;if jump status is 1 -> branch
ld (KEYIN),K_LOCAL ;for cash conversion [local] key function
jp local_key_start
tax_minus_a:
ld wa,F_RATE
test (F_RATE>>4).a ;bit -reverse-> jump status
j f,tax_plus_0 ;if jump status is 0 -> branch
call tax_equ
ld wa,F_CALER
test (F_CALER>>4).a ;bit -reverse-> jump status
j f,tax_equ_end ;if jump status is 0 -> branch
j cs,no_operation
call ten_to_w2dp
cmp (PRE_KEY),K_TXP ;
j eq,tax_min00 ;
;------------------------------------------------------
tax_minus_yuan:
call w2_to_w4 ;backup tenkey buffer
tax_min00: ;
;---------------------------------------------------tax rate---> w1
ld (SYM),S_SPC
ld wa,F_TNKEY
test (F_TNKEY>>4).a ;bit -reverse-> jump status
j f,tax_calc_0 ;if jump status is 0 -> branch
ld (SYM),S_ST
tax_calc_0:
ld hl,W2
call wk_print ;W2(input value) print
call tax_to_w1
ld (SYM),S_TAX
ld hl,W1
call wk_print
;---------------------------------------is [tax+] or [tax-]? [tax+]--->
cmp (KEYIN),K_TXP ;\tax+ key?
j eq,tax_plus_calc ;/ yes -> tax+ calculation [W1<- W1(rate)*W2(input)]
;------------------------------------------------for [tax-]
;tax- calculation........
tax_minus_calc: ;V1.24
;------------------------------------------for stand logic [tax-], tax rate already in stay 'w1'
;V1.33 @S100_W2 ;set 100 to W2
;V1.33 call calc_add ;W1 <- 1 + rate/100
call w2_clear
ld (W2_LSD-1),0x01 ;set 100 to W2
call calc_div ;W1 <- 100+rate/100
call w2_clear
ld (W2_LSD),0x01 ;set 1 to W2
call calc_add ;
call ten_to_w2
call exchg_w12
call calc_div ;W1 <- input / (1+rate/100)
ld hl,W1 ;V1.32
call wk_round ;V1.32
;----------------------------------------------------------------------
tax_minus_yy_z1:
ld wa,F_CALER
test (F_CALER>>4).a ;bit -reverse-> jump status
j f,tax_min99 ;if jump status is 0 -> branch
call w1_to_w2 ;V1.13\
xor (W2_S),1 ;V1.13|compute for dalta
call ten_to_w1 ;V1.13|
call calc_add ;V1.13/
jp tax_minus_yy_z3 ;V2.10
tax_minus_yy_z0: ;V2.10
call w1_to_w2 ;V2.10
call tax_to_w1 ;\V2.10
ld wa,F_PERCAL
set (F_PERCAL>>4).a
call calc_mult ;V2.10
tax_minus_yy_z3: ;V2.10
;V3.01 ld (SYM),S_DLTA ;V1.13\
ld (SYM),0x15 ;delta-
ld wa,F_MIN_TRA
set (F_MIN_TRA>>4).a
ld hl,W1 ;V1.13
call wk_round ;V1.13
jp tax_min1_z ;V2.10
tax_min1_z:
call wk_print ;V1.13
ld wa,F_MIN_TRA
clr (F_MIN_TRA>>4).a
xor (W1_S),1 ;V1.13
call tax_to_w1
call w2_clear
ld (W2_LSD-1),0x01 ;set 100 to W2
call calc_add
call ten_to_w2 ;V1.28
call exchg_w12 ;V1.28
ld wa,F_PERCAL
set (F_PERCAL>>4).a
call calc_div
; call calc_add ;V1.28
;------------------------------------- check for prevenient key is [tax+]?
cmp (PRE_KEY),K_TXP ;V1.14
;V4.12 @IS_TX2
;V4.12 j t,tax_min1_yy ;V1.24
;V4.12 cmp (PRE_KEY),K_TX2P ;V1.24
;----------------------------------------------------------------------
tax_min1_yy: ;V1.24
j ne,tax_min5 ;V1.14
ld (KEYIN),0xff ;V1.35b
call w4_to_w1 ;V1.14
jp tax_min5 ;V1.13
;-------------------------------------------------------------[tax-] compute accomplish
;------------------------------------------for [tax+] compute
tax_plus_calc: ;w1=tax rate, w2=ten
ld wa,F_PERCAL
set (F_PERCAL>>4).a
call calc_mult ;W1 <- input * rate(%)=dalta
ld wa,F_CALER
test (F_CALER>>4).a ;bit -reverse-> jump status
j f,tax_min99 ;if jump status is 0 -> branch
call w1_to_w2 ;V1.11
ld hl,W2 ;V1.11
call wk_round
;V3.01 ld (SYM),S_DLTA ;
ld (SYM),0x14 ;delta+
cmp (KEYIN),K_TXP ;tax+ key?
test (FLG_MODE).4
j t,tax_min2_x ;V1.17
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -