📄 business_fn.asm
字号:
cmp (KEYIN),K_TX2P ;V1.17
tax_min2_x:
j eq,tax_min3 ; yes ->
; ld (SYM),S_DLM ;
; @SEB (F_MIN_TRA) ;for print tax amount in red
xor (W1_S),1 ;W1(tax amount) sign change
xor (W2_S),1 ;only for print ;v1.11
tax_min3: ;V1.35b
call wk_print ;W1(tax amount) print
; @CLB (F_MIN_TRA) ;
tax_min4:
call tax_to_w1
call w2_clear
ld (W2_LSD-1),0x01 ;set 100 to W2
call calc_add
ld wa,F_PERCAL
set (F_PERCAL>>4).a
call w1_to_w2
call ten_to_w1 ;V1.28
; call calc_add ;W1 <- without tax
call calc_mult
cmp (PRE_KEY),K_TXM ;V1.14
test (FLG_MODE).4
j t,tax_min4x ;V1.17 not tax2 mode
cmp (PRE_KEY),K_TX2M ;V1.17
jp tax_min4x ;V1.35b
tax_min4x: ;V1.17
j ne,tax_min5 ;V1.14
ld (KEYIN),0xff ;V1.35b
call w4_to_w1 ;V1.14
tax_min5: ;V1.13
ld wa,F_CALER
test (F_CALER>>4).a ;bit -reverse-> jump status
j f,tax_min9 ;if jump status is 0 -> branch
ld hl,W1
call _zerock ;V1.34
j ne,tax_min50 ;V1.34
ld (W1_S),0 ;V1.34
tax_min50: ;V1.34
call wk_round
ld (SYM),S_AST ;
call wk_print ;W1(tax amount) print
call feed_1
call w1_to_ten ;for display calculated answer(W1)
tax_min9:
;V4.13 @CLB (M_TX2) ;V1.17
tax_min91: ;V1.19
;V4.12 ld a,(FLG_C) ;V1.26\
;V4.12 and a,0y00000000 ;V1.40
;V4.12 ld (FLG_C),a ;V1.26/
and (FLG_C),0 ;V4.12
;V4.12 ld a,(FLG_E) ;clear all calculate instruction flags except E_MUP,E_MUL,E_DIV
;V4.12 and a,0y00001111 ;V1.40
;V4.12 ld (FLG_E),a
and (FLG_E),0x0f ;V4.12
test (FLG_MODE).2
j t,tax_min92
and (FLG_E),0 ;V4.12
tax_min92: ;V4.12
ld (SYM),S_AST ;for error print
j function_end
tax_min99:
ld wa,F_ZDIVER
set (F_ZDIVER>>4).a
;V1.30 call w1_clear
j tax_min9
;===============================================
; subroutine for tax function
;===============================================
tax_save:
call keep_ten_6dig
call ten_to_w2
call w2_to_tax
call w2_to_eetx
;----------------------------------
tax_recall:
call tax_to_w1
call w1_to_ten
ld (SYM),S_TAX
call keep_ten_6dig
call ten_to_w1
ld hl,W1
call wk_print ;TAX rate print
call feed_1
call w1_to_ten ;for display tax rate(W1)
call spc_disp
ld hl,TENKEY
call edit_disp
ld (DISP+5),D_T
ld (DISP+6),D_EQU
call disp_to_dbr
call ten_clear
ld wa,EURO_DISPLY
set (EURO_DISPLY>>4).a
ld (KEYIN),K_EURO_LOCAL_TAX_DUM
ld (PRE_KEY),K_EURO_LOCAL_TAX_DUM
ret
;------------------------------------
tax_equ:
ld a,(FLG_E)
and a,0y00000011
j eq,tax_equ_exit
ld wa,F_TNKEY
test (F_TNKEY>>4).a ;bit -reverse-> jump status
j t,tax_equ_exit9 ;if jump status is 1 -> branch
call equal_sub
call w1_round
call w1_to_ten
ld wa,F_TNKEY
clr (F_TNKEY>>4).a
tax_equ_exit:
clr cf
ret
tax_equ_exit9:
set cf
ret
;V2.07===========================================================================
; [TAX12+]/[TAX12-]
;================================================================================
tax12_plus:
tax12_minus:
;V4.01 call ten_to_w1 ;tenkey -> W2(no DP adjustment)
;V4.01 ld hl,W1 ;keep 2 float decimal
;V4.01 call check_dp_over2 ;
;V4.01 ld (SYM),S_SPC ;\
;V4.01 ld hl,W1 ;|
;V4.01 call wk_print ;/W2(input value) print
;V4.01 cmp (KEYIN),K_TX12P ;V2.13
;V4.01 j eq,tax12_minus2 ;V2.13
;V4.01 call tax_to_w1
;V4.01 call w1_to_w2
;V4.01 call tax2_to_w1
;V4.01 call calc_add ;rate tax1+rate tax2
;V4.01 @S100_W2 ;set 1 to W2
;V4.01 call calc_div ;W1 <- 100+rate/100
;V4.01 @S1_W2 ;|
;V4.01 call calc_add ;/
;V4.01 call ten_to_w2
;V4.01 call exchg_w12
;V4.01 cmp (KEYIN),K_TX12P
;V4.01 j eq,tax12_minus1
;V4.01 call calc_div ;total amount come out, W1 <- input / [1+(tax1+tax2)/100]
;V2.12 call fix_round_down_keep_2dp
;V4.01 jp tax12_minus2
;V4.01tax12_minus1:
;V4.01 call calc_mult
;V4.01 call fix_round_up_keep_2dp
;V4.01tax12_minus2:
;V2.12 call keep_2dp ;V2.12
;V2.13 call w1_to_w2
;V2.13 call ten_to_w1
;V2.13 xor (W1_S),1
;V2.13 call calc_add
;V2.13 cmp (KEYIN),K_TX12P
;V2.13 j ne,tax12_minus2x ;V2.12
;V2.13 call fix_round_down_keep_2dp ;V2.12
;V2.13 jp tax12_minus2y ;V2.12
;V2.13tax12_minus2x: ;V2.12
;V2.13 call fix_round_up_keep_2dp ;V2.12
;V2.13tax12_minus2y: ;V2.12
;V4.01 call w1_to_w4 ;backup total dalta W1
;V4.01 @CLB (M_TX2)
;V4.01 @SEB (M_TX1)
;V4.01 call tax_mark_print ;out print ' ....1....'
;V4.01 call tax_to_w1 ;\
;V4.01 ld (SYM),S_PER ;
;V4.01 ld hl,W1 ;
;V4.01 call check_dp_over2 ;
;V4.01 call wk_print ; tax1 rate print out
;V4.01
;V4.01 @BBS (F_CALER,tax12_end)
;V4.01 call tax_to_w1
;V2.13 call w1_to_w2
;V2.13 call tax2_to_w1
;V2.13 call calc_add ;rate tax1+rate tax2
;V2.13 call w1_to_w2
;V2.13 call tax_to_w1
;V2.13 ld hl,W2 ;V2.12
;V2.13 call _zerock ;V2.12
;V2.13 j eq,tax12_minus_21 ;V2.12
;V2.13 call calc_div
;V4.01tax12_minus_21: ;V2.12
;V4.01 call w4_to_w2
;V4.01 @SEB (F_PERCAL) ;V2.13
;V4.01 call calc_mult
;V4.01 @BBS (F_CALER,tax12_end)
;V4.01 ld hl,W1
;V4.01 call fix_round_up_keep_2dp ;V2.13
;V4.01 cmp (KEYIN),K_TX12P
;V4.01 j ne,tax12_minus_3 ;V2.11
;V2.13 call fix_round_up_keep_2dp
;V4.01 jp tax12_minus_4 ;V2.11
tax12_minus_3: ;V2.11
;V2.13 call fix_round_down_keep_2dp ;V2.11
;V2.13 call _zerock ;V2.12
;V2.13 j ne,tax12_minus_4 ;V2.12
;V4.01 or (W1_S),1 ;V2.12
tax12_minus_4: ;V2.11
;V2.13 call keep_2dp ;V2.12
;V4.01 ld (SYM),S_DLTA
;V4.01 call wk_print
;V4.01 call w1_to_ftemp ;V2.13 backup this result
;V4.01 @CLB (M_TX1)
;V4.01 @SEB (M_TX2)
;V4.01 call tax_mark_print ;out print ' ....2....'
;V4.01 call tax2_to_w1
;V4.01 ld (SYM),S_PER
;V4.01 ld hl,W1
;V4.01 call check_dp_over2 ;
;V4.01 call wk_print ; tax2 rate print out
;V4.01 call w4_to_w2
;V4.01 @SEB (F_PERCAL) ;V2.13
;V4.01 call calc_mult ;V2.13
;V4.01 @BBS (F_CALER,tax12_end) ;V2.13
;V4.01 ld hl,W1 ;V2.13
;V4.01 call fix_round_up_keep_2dp ;V2.13
;V4.01 cmp (KEYIN),K_TX12P ;V2.13
;V4.01 j eq,tax12_minus_6 ;V2.13
;V2.13 ld hl,W2
;V2.12 call fix_round_up_keep_2dp
;V2.13 call keep_2dp ;V2.12
xor (W1_S),1
;V2.13 call calc_add
;V2.13 call w2_to_w4 ;backup W2 total delta
;V2.13 @BBS (F_CALER,tax12_end)
;V2.13 ld hl,W1
;V2.13 cmp (KEYIN),K_TX12P ;V2.12
;V2.13 j ne,tax12_minus_5 ;V2.12
;V2.13 call fix_round_up_keep_2dp ;V2.12
;V2.13 jp tax12_minus_6 ;V2.12
;V4.01tax12_minus_5: ;V2.12
;V2.12 call fix_round_down_keep_2dp ;V2.12
;V2.13 call _zerock ;V2.12
;V2.13 j ne,tax12_minus_6 ;V2.12
;V2.13 or (W1_S),1 ;V2.12
;V4.01tax12_minus_6: ;V2.12
;V2.13 call keep_2dp ;V2.12
;V4.01 ld (SYM),S_DLTA
;V4.01 call wk_print
;V4.01 @SEB (M_TX1)
;V4.01 @SEB (M_TX2)
;V4.01 call tax_mark_print ;out print ' ...1,2...'
;V4.01 call ftemp_to_w2 ;V2.13
;V4.01 call calc_add ;V2.13
;V2.13 call w4_to_w2
;V4.01 ld hl,W1
;V2.13 call fix_round_up_keep_2dp ;V2.13
;V4.01 call keep_2dp ;V2.13
;V4.01 ld (SYM),S_DLTA
;V4.01 call wk_print
;V4.01 call ten_to_w2
;V4.01 call calc_add
;V4.01 ld hl,W1
;V4.01 call fix_round_up_keep_2dp ;V2.13
;V4.01tax12_end:
;V4.01 jp tax_min9
;V2.07==========================================================================
;===============================================================================
; COST key
;===============================================================================
cost_key:
;V4.01 @BBC (M_FINANCE,cost_operation) ;V1.17a
;V4.01cost_key_x:
;V4.01 jp no_operation ;V1.17a
cost_operation: ;V1.17a
;V1.26 cmp (TEN_CT),0 ;with tenkey?
;V1.26 j ne,cost_key2 ; yes ->
ld wa,F_TNKEY
test (F_TNKEY>>4).a ;bit -reverse-> jump status
j f,cost_key2 ;if jump status is 0 -> branch
cost_operation_1:
;no tenkey entry.......
ld a,(PRE_KEY) ;check previouse key(reg.a)
call kychk_sttl ;V1.17a;V1.40 ;check ST,TL,MST,MTL,GT M2ST,M2TL key
j eq,cost_key2 ;V1.17a;V1.40 ;Z=1: yes -> set price ot execute calculation
ld w,(FLG_C) ;check constant flags
and w,0y11110000 ;C_MAR,C_SEL,C_CST on? ;V1.41
;V1.42 and w,0y01110000 ;C_MAR,C_SEL,C_CST on? V1.42
j z,cost_key0 ; no(after entry C,S,M or nothing entry) ->
call kychk_csm ;check cost, sell, margin or cce key
j eq,cost_rcall ;Z=1: yes -> recall function
ld (FLG_C),0 ;clear all constant flags
ld (FLG_E),0 ;clear all calculate instruction flags
j cost_key2 ; -> set price
cost_key0:
ld w,(FLG_E) ;V1.17a;V1.40 ;check entry flags
and w,0y01110000 ;V1.17a;V1.40 ;E_MAR,E_SEL,E_CST on?
j z,cost_key2 ;V1.17a;V1.40 ;no any entry flags yes-> set cost price(display value)
test (FLG_MODE).2
j t,cost_key2
cmp a,K_CST ;V4.12
;V3.03 call kychk_csm ;V1.17a;V1.40 ;check cost, sell, margin or cce key
j eq,no_operation ;V3.03;V1.17a;V1.40 ;Z=1: yes -> no operation
;V3.03 ld (FLG_E),0 ;V1.17a;V1.40 ;clear all calculate instruction flags
j cost_key2;V1.28 ;V1.40 ; -> set price
;recall previouse cost price....
cost_rcall:
call cost_to_w2
ld (SYM),S_COST ;cost symbol
ld hl,W2
call wk_print ;V1.17b
;V1.17b call wk_prn_2L ;W2(input value) print with check 2line print
call feed_1
call w2_to_ten ;for display recall value(W2)
ld (FLG_E),0
j function_end
;with tenkey entry.......
cost_key2:
test (FLG_MODE).2
j t,cost_key2_1
call ten_to_w2dp ;V4.09
jp cost_key2_2 ;V4.09
cost_key2_1: ;v4.09
call ten_to_w2 ;tenkey -> W2(no DP adjustment)
cost_key2_2:
call w2_to_cost ;input -> cost backup
ld (SYM),S_COST ;cost symbol
ld hl,W2
call wk_print ;V1.17b
;V1.17b call wk_prn_2L ;W2(input value) print with check 2line print
ld wa,C_SEL
test (C_SEL>>4).a ;bit -reverse-> jump status
j f,cost_key4 ;if jump status is 0 -> branch
ld wa,C_MAR
test (C_MAR>>4).a ;bit -reverse-> jump status
j f,cost_key4 ;if jump status is 0 -> branch
;just after x -cost calculation or normal sell entry............
ld (FLG_C),0 ;clear all constant flags
ld wa,C_CST
set (C_CST>>4).a
ld wa,E_SEL
test (E_SEL>>4).a ;bit -reverse-> jump status
j f,cs_sl_calc ;if jump status is 0 -> branch
ld wa,E_MAR
test (E_MAR>>4).a ;bit -reverse-> jump status
j f,cs_mg_calc ;if jump status is 0 -> branch
;set cost price......
cost_key4:
;V2.00 @SEB (LCD_COST) ;V1.18
ld (FLG_C),0 ;clear all constant flags
ld (FLG_E),0 ;clear all calculate instruction flags
ld wa,E_CST
set (E_CST>>4).a
call w2_to_ten ;for display input value(W2)
j function_end
;===============================================
; check key (ST,TL,MST,MTL,GT)
;===============================================
kychk_sttl:
;V4.12 @IS_5514_OFF(kychk_sttl8) ;V4.12
;V4.12 cmp a,K_IC ;V4.12
;V4.12 j eq,kychk_sttl9 ;V4.12
;V4.12 cmp a,K_SHD ;V4.12
;V4.12 j eq,kychk_sttl9 ;V4.12
;V4.12kychk_sttl8: ;V4.12
cmp a,K_ST
j eq,kychk_sttl9
cmp a,K_TL
j eq,kychk_sttl9
cmp a,K_MST
j eq,kychk_sttl9
cmp a,K_MTL
j eq,kychk_sttl9
;V4.01 cmp a,K_M2ST
;V4.01 j eq,kychk_sttl9
;V4.01 cmp a,K_M2TL
;V4.01 j eq,kychk_sttl9
;V4.01 cmp a,K_GT
;V4.01 j eq,kychk_sttl9
;also allow to calculate C-S-M if previouse entery as below key code (even display value is 0 or not changed)
cmp a,K_SGN ;after change sign -> calculate
j eq,kychk_sttl9
cmp a,K_BS ;after tenkey - BS key -> calculate
j eq,kychk_sttl9
cmp a,K_ZERO ;after 0 key -> calculate
kychk_sttl9:
ret
;===============================================
; check key (COST,SELL,MARGIN,CEC)
;===============================================
kychk_csm:
cmp a,K_CST
j eq,kychk_csm9
cmp a,K_SEL
j eq,kychk_csm9
cmp a,K_MGR
j eq,kychk_csm9
cmp a,K_CEC ;
kychk_csm9:
ret
;===============================================
; check key (ST,TL,MST,MTL,GT)
;===============================================
kychk_clcsm:
ld a,(KEYIN)
test (FLG_MODE).2
j t,kychk_clcsm_1
cmp a,K_SHD ;V4.12
j eq,kch_clcsm9 ;V4.12
cmp a,K_IC ;V4.12
j eq,kch_clcsm9 ;V4.12
kychk_clcsm_1: ;V4.12
cmp a,K_DP
j le,kch_clcsm9
;V1.40 jp kch_clcsm99 ;V1.28;V1.40
cmp a,K_CE ;V1.28;V1.40
j eq,kch_clcsm9 ;V1.28;V1.40
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -