📄 basic_fn.mac
字号:
j ge,altervable_euro_to_ten
call fix_euro_to_ten
jp altervable_euro_to_ten_end
altervable_euro_to_ten:
ld a,(COUNTRY_TEN)
clr cf
sub a,12
call ee_to_ten
call keep_ten_6dig
altervable_euro_to_ten_end:
ld hl,TENKEY
call euro_print
ld a,(COUNTRY1)
cmp a,(COUNTRY2)
j ne,altervable_euro_to_ten_end_1
cmp a,(COUNTRY_TEN)
j ne,altervable_euro_to_ten_end_1
@BBS (F_COUNTRY_EQU,altervable_euro_to_ten_end_1)
@SEB (F_COUNTRY2)
@SEB (F_COUNTRY_EQU)
dec (COUNTRY_TEN)
altervable_euro_to_ten_end_1:
inc (COUNTRY_TEN)
cmp (COUNTRY_TEN),17
j lt,equal_obs_rate_recall
equal_obs_rate_recall_end:
call feed_1
call ten_clear
@CLB (F_COUNTRY_EQU)
@BBC (M_5514T,function_end) ;V4.12
@CLB (F_COUNTRY) ;V4.12
jp function_end
;---------------------------------------
print_present_rate:
call keep_ten_6dig
call euro_display
ld a,(COUNTRY_TEN) ;V4.10
cmp a,(COUNTRY1) ;v4.10
;V4.17 j eq,print_present_rate1 ;v4.10
j ne,print_present_rate1 ;V4.17
call ten_to_euro1
print_present_rate1:
ld a,(COUNTRY_TEN) ;V4.17
cmp a,(COUNTRY2) ;V4.10
j ne,print_present_rate2 ;V4.10
call ten_to_euro2 ;V4.10
;V4.17 j print_present_rate2 ;V4.10
;V4.17print_present_rate1: ;V4.10
;V4.17 call ten_to_euro1 ;V4.10
print_present_rate2: ;v4.10
ld hl,TENKEY
call euro_print
call euro_set_sub
call feed_1
call ten_clear
@CLB (F_RATE) ;top blinking and recall rate when no EEPROM
@CLB (RATE_PROG)
@CLB (EURO_PROG)
@CLB (F_TNKEY)
@CLB (F_DPIN)
ld (TEN_CT),0 ;
ld (DT_CT),0 ;
ld (DT_DOT_CNT),0 ;
ld (DT_CHR_CNT),0 ;
ld (KEYIN),K_EURO_LOCAL_TAX_DUM
ld (PRE_KEY),K_EURO_LOCAL_TAX_DUM
jp no_operation
;-----------------------------------------------------------
;V3.00 @BBC (M_VIC,equal_start) ;V2.10
;V3.00 @BBC (E_DIV,equal_start) ;V1.34
;V3.00 cmp (PRE_KEY),K_DIV ;V1.34
;V3.00 j ne,equal_start ;V1.34
;V3.00 ld (KEYIN),K_ROOT ;V1.34
;V3.00 jp square_root ;V1.34
equal_start: ;V1.34
@BBS (F_PEREXE,no_operation) ;V1.25
ld a,(FLG_E)
and a,0y00001111 ;E_MUL,E_DIV,E_DLT,E_MUP only
j nz,equal_key0
ld a,(FLG_C)
and a,0y00001111 ;C_MUL,C_DIV,C_DLT,C_MUP only
j z,no_operation ;if no calculate instruction yes-> exit
equal_key0:
@BBS (E_MUP,equal_mup) ;MU key entered?
@BBS (C_MUP,equal_mup) ;MU constant calculation?
@BBS (E_DLT,equal_dlt) ;V1.19
@BBS (C_DLT,equal_dlt) ;V1.19
equal_key2:
call equal_sub
@BBS (F_CALER,equal_key9) ;if error occured? yes->
ld hl,W1
call wk_round ;W1(calculated answer) rounding
ld (SYM),S_AST
;V1.27-------------------------------
;V4.13 @BBC (SW_SG,equal_key3) ;V2.07
;V4.13 ld (SYM),S_PLS ;v2.07
equal_key3:
ld hl,W1 ;V1.27
call wk_print ;W1(calculated answer) print
call feed_1
call w1_to_ten ;for display calculated answer(W1)
;V4.13 @SEB (F_FNEABL) ;V1.09
;V4.13 @BBC (SW_SG,equal_key9) ;V1.17
;V4.13 call w1_to_w2 ;V1.33
;V4.13 ld hl,ACC ;V1.33
;V4.13 call wk_update ;V1.33
;V4.13 @BBS (F_CALER,equal_key9) ;V1.33
;V4.13 ld hl,IC_A ;V1.33
;V4.13 call ic_update ;V1.33
equal_key9:
ld (SYM),S_AST ;for error print
j function_end
equal_mup:
@IS_5514_OFF(equal_mup_x);V4.09
call ten_to_w2dp ;V4.09
jp equal_mup_y ;v4.09
equal_mup_x: ;V4.09
call ten_to_w2 ;tenkey -> W2(no DP adjustment)
equal_mup_y: ;V4.09
;V4.12 @SEB (F_REVCAN) ;V4.09
ld (SYM),S_PRMU
ld hl,W2
call wk_print ;W2(input value) print
call w2_to_w1
@S100_W2 ;set 100 to W2
call calc_div ;W1 <- MU%/100
xor (W1_S),0x01 ;W1(MU%/100) sign change
@S1_W2 ;set 1 to W2
call calc_add ;W1 <- 1 - (MU%/100)
call w1_to_w2
call const_to_w1
call calc_div ;W1 <- cost price / (1-margin/100)
@BBS (F_CALER,equal_mup99)
call w1_to_w4 ;V1.17
ld hl,W1 ;V1.09
call wk_round ;V1.09
call const_to_w2 ;V1.32
xor (W2_S),1 ;V1.32
call calc_add ;W1(difference) <- selling price - cost price
@BBS (F_CALER,equal_mup9)
call w1_to_w2 ;W2 <- diffrence
ld hl,W1 ;V1.09
call wk_round ;V1.09
equal_mup_1: ;V1.33
ld (SYM),S_DLAS ;
call wk_print ;defference print
call w4_to_w1 ;V1.17
ld hl,W1
call wk_round ;
ld (SYM),S_AST ;
call wk_print ;selling price print
ld (FLG_C),0 ;clear all constant caluculation flags
@SEB (C_MUP)
ld (FLG_E),0 ;clear all caluculate instruction flags
call feed_1
call w1_to_ten ;
equal_mup9:
ld (SYM),S_AST ;for error print
j function_end
equal_mup99:
@SEB (F_ZDIVER)
ld hl,W1 ;V1.30
call _zerock ;V1.30
j ne,equal_mup9 ;V1.30
and (W1_S),0 ;V1.30
j equal_mup9
;------------------------------------------------------------
equal_dlt:
@IS_5514_OFF(equal_dlt_x) ;v4.09
call ten_to_w2dp ;V4.09
jp equal_dlt_y ;V4.09
equal_dlt_x: ;V4.09
call ten_to_w2 ;tenkey -> W2(no DP adjustment)
equal_dlt_y: ;V4.09
;V4.12 @SEB (F_REVCAN) ;V4.09
ld (SYM),S_EQU
ld hl,W2
call wk_print
call const_to_w1
call exchg_w12 ;V1.34
xor (W2_S),1 ;V1.34
call calc_add
@BBS (F_CALER,equal_dlt9)
ld hl,W1 ;
;V3.00 call wk_round ;
;V3.00 @BBS (M_VIC,equal_dlt_0) ;V2.06
;V3.00 ld (SYM),S_DLTA
;V3.00 jp equal_dlt_1 ;V1.30
;V3.00equal_dlt_0: ;V1.30
ld (SYM),S_DLAS ;V1.30
equal_dlt_1:
call wk_print
call const_to_w2
@SEB (F_PERCAL)
call calc_div ;
@BBS (F_CALER,equal_dlt99)
ld hl,W1
call _zerock
j ne,equal_dlt_1_0 ;V1.34
ld (W1_S),0 ;V1.34
equal_dlt_1_0: ;V1.34
call wk_round
;V3.00 ld (SYM),S_PER ;
;V3.00 @BBC (M_VIC,equal_dlt_2) ;V2.06
ld (SYM),S_PRDL ;V1.30
equal_dlt_2: ;V1.30
call wk_print ;
ld (FLG_C),0 ;
@SEB (C_DLT)
ld (FLG_E),0 ;
call feed_1
call w1_to_ten ;
equal_dlt9:
ld (SYM),S_AST ;
j function_end
equal_dlt99:
call w1_clear
j equal_dlt9
;-------------------------------------------------------------------
equal_sub:
@SEB (F_REVCAN) ;V4.12
;V1.32 ld a,(TEN_CT) ;no tenkey?
;V1.32 j nz,equal_s2 ; with tenkey ->
@BBS (F_TNKEY,equal_s2) ;V1.32
;if no tenkey entry, check x,div,repeat entry........
cmp (PRE_KEY),K_MUL ;if previouse key is X ?
j eq,equal_s3 ; yes -> use W2(previouse multiplicand value) for repeat entry
cmp (PRE_KEY),K_DIV ;if previouse key is div ?
j eq,equal_s3 ; yes -> use W2(previouse dividend value) for repeat entry
equal_s2:
cmp (KEYIN),K_PER ;V1.28\for percent calculate, no need 'adm'
j eq,equal_s22 ;V1.28/
;V4.13 @BBC (SW_ADM12,equal_s22) ;V1.16
;V4.13 @BBS (E_MUL,equal_s21) ;V1.16
;V4.13 @BBS (C_MUL,equal_s21) ;V1.16
;V1.30 @BBS (E_DIV,equal_s21) ;V1.30
;V4.13 @BBS (C_DIV,equal_s21) ;V1.30
;V4.13 jp equal_s22 ;V1.16
equal_s21: ;V1.16
;V4.13 call add_mode ;V1.16
;V4.13 j cs,equal_s3 ;V1.16
equal_s22: ;V1.16
@IS_5514_OFF(equal_s23) ;V4.09
call ten_to_w2dp ;V4.09
jp equal_s24 ;V4.09
equal_s23: ;V4.09
call ten_to_w2 ;tenkey -> W2(no DP adjustment)
equal_s24: ;V4.09
equal_s3:
ld hl,W2
ld (SYM),S_EQU
cmp (KEYIN),K_PER ;% key?
j ne,equal_s4 ; no ->
ld (SYM),S_PER
@SEB (F_PERCAL)
equal_s4:
call wk_print ;W2(input value) print
call calc_sub ;calculation if Mul or Div flag is set before
ld a,(FLG_E) ;copy FLG_E to FLG_C for constant calculation
j z,equal_s6 ;if no FLG_E flags(means constant calculation) yes-> do not copy FLG_E -> FLG_C
and a,0y00000011 ;E_MUL,E_DIV only
ld (FLG_C),a ;
ld (FLG_E),0 ;clear all caluculate instruction flags
equal_s6:
ret
calc_sub:
@BBS (E_MUL,calc_smul)
@BBS (E_DIV,calc_sdiv)
@BBS (C_MUL,calc_smul) ;constant multiple calculation ->
@BBS (C_DIV,calc_sdivc) ;constant divide calculation ->
call w2_to_w1 ;if no Mu or Div instruction, set input value to calculated answer
j calc_sub9
calc_smul:
call const_to_w1
call calc_mult ;CONST x input value -> W1
j calc_sub9
calc_sdiv:
call const_to_w1
call calc_div ;CONST / input value -> W1
call w2_to_const ;input value save to CONST(for constant calculation)
@BBC (F_CALER,calc_sdiv_1) ;V1.32
@SEB (F_ZDIVER) ;V1.32
calc_sdiv_1: ;V1.32
j calc_sub9
calc_sdivc:
call const_to_w1 ;when constant division calculation, W2(input)is dividend and CONST is divider
call exchg_w12 ; W1(input value) W2(CONST)
call calc_div ; input value / CONST -> W1(answer)
@BBC (F_CALER,calc_sdivc_1) ;V1.32
@SEB (F_ZDIVER) ;V1.32
calc_sdivc_1: ;V1.32
calc_sub9:
@CLB (ERR_CLR) ;for judge just after clear calculation error
ret
;===============================================================================
;square root
;===============================================================================
square_root:
@BBS (F_RATE,no_operation) ;V4.07
call w1_clear ;V4.12
call ten_to_w2dp
call w2_to_w4
ld (SYM),S_ROOT
@SEB (F_REVCAN) ;V4.07
call w2_print
@SEB (F_DOFF) ;V2.05
test (W2_S).0
j t,square_root_0
@SEB (F_CALER)
jp square_root_99
square_root_0:
ld hl,W2
call _zerock
j z,square_root_90
ld d,13
ld c,0
ld hl,W2_MSD
square_root_1:
ld a,(hl+c)
and a,0xf0
j nz,square_root_2
dec d
ld a,(hl+c)
and a,0x0f
j nz,square_root_2
dec d
inc c
jp square_root_1
square_root_2:
set cf
sub d,(W2_DP)
j f,square_root_21
ld c,0
set cf
sub c,d
ld hl,root_tab_b
jp square_root_3
square_root_21:
ld hl,root_tab_a
ld c,d
square_root_3:
shlc c
shlc c
shlc c
ld d,7
ld ix,W2_MSD
square_root_22:
ld a,(hl+c)
ld (ix),a
inc c
inc ix
dec d
j f,square_root_22
ld e,15
square_root_4:
call ten_to_w1
call calc_div
call calc_add
call w2_clear
ld (W2_LSD),2
call calc_div
call exchg_w12
call w4_to_w1
xor (W1_S),1
call calc_add
ld hl,W1
call _zerock
j z,square_root_90
call w2_to_w4
dec e
j f,square_root_4 ;V1.18 avoid 0.99999999998 no end cycle
square_root_90:
call com_w2_0p9999999999
j nz,square_root_91
call w2_clear
ld (W2_LSD),1
square_root_91:
ld (SYM),S_AST
ld hl,W2
call w2_round_print
call w2_to_ten
call feed_1
square_root_99:
;V4.17 ld (FLG_E),0
;V4.17 ld (FLG_C),0 ;V1.40
@CLB (F_DOFF) ;V2.05
ld (SYM),S_AST ;V4.12
jp function_end
;--------------------------------
com_w2_0p9999999999:
call w1_clear
@BBC (M14,com_w2_0p1)
ld (W1_MSD),0x09
ld (W1_MSD+1),0x99
ld (W1_MSD+2),0x99
jp com_w2_0p3
com_w2_0p1:
@BBS (M10,com_w2_0p2)
ld (W1_MSD+1),0x09
ld (W1_MSD+2),0x99
jp com_w2_0p3
com_w2_0p2:
ld (W1_MSD),0x00
ld (W1_MSD+1),0x00
ld (W1_MSD+2),0x09
com_w2_0p3:
ld (W1_MSD+3),0x99
ld (W1_MSD+4),0x99
ld (W1_MSD+5),0x99
ld (W1_MSD+6),0x99
ld (W1_DP),11
@BBC (M14,com_w2_0p4)
ld (W1_DP),13
jp com_w2_0p5
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -