📄 basic_fn.mac
字号:
$nolist
;*******************************************************************************
;*******************************************************************************
;* *
;* (C)Copyright, CLOVER China Electronics Co.,LTD. *
;* All Rigits Reserved *
;* add:No.58-F Yang Dong Road, LuoFeng Demonstrative Zone Suzhou, China *
;* Tel: 0512-67261886 Fax:0512-67261882 *
;* http://www.clover.co.jp *
;* *
;*******************************************************************************
;*******************************************************************************
;
; OBS CPD3212T source program
; CPU: TOSHIBA TLC-870/C series TMP86CM74A
; RAM: 2Kbytes(0040h - 083Fh)
; ROM: 32Kbytes(a000h - FFFFh)
;
;
;Basic function............................
?trigger(@)
@include "symdef_ram.inc"
@include "symdef_sub.inc"
@include "macro.inc"
@include "define.inc"
$list
public tenkey,dp_key,gt_key,cec_key,acc_plus,acc_minus,acc_subtl,acc_total
public equal_key,percent_key,perplus_key,multi_key,divide_key,sharp_subtl ;V2.03feed_key,
public markup_key,delta_percent,sign_change,back_space,sharp_date,all_clear,work_clear,work_clear_acc
public mem_minus,mem_plus,mem_subtl,mem_total,mem2_minus,mem2_plus,mem2_subtl,mem2_total
public ce_key,item_key,tenkey,enter_stop;V2.03prn_mode_key,off_key,fin_mode_key,decimal_set_key,
public square_root,mem2_plus,mem2_minus,equal_sub
extern function_end,tenkey_end,no_operation,shp_sgn_end ;V2.03,feed_key_end
extern init_scan,init_io,function_end9,function_end_0;V2.00init_lcd,init_pf
extern check_dp_over2 ;key_amount,key_interest,key_month,key_payment,
extern eurate_minus_key,eurate_plus_key,resume,rate_ten_key;lcd_display_exp,
;V3.00 extern time_key,rtc_key_equ,rtc_key_mul,rtc_key_div
extern tax2_plus,tax2_minus,tax_plus,tax_minus,tax_plus_a,tax12_plus,tax12_minus
extern functionnoclearftenkey,lcd_display_exp,tax_minus_a,tax_plus_x,tax_minus_x
extern keep_ten_6dig,rate_ten_key_01,fix_euro_to_ten,euro_print,euro_display
extern euro_rate_recall_x,euro_set_sub
extern wk_print9,edit_prn
extern rate_ten_key_01 ;V4.12
ROM section code
IC_HOLD_TIM equ 150
GT_HOLD_TIM equ 150
;===============================================================================
; Tenkey input
;===============================================================================
tenkey:
@BBS (F_RATE,rate_ten_key) ;V3.01
@BBS (F_TNKEY,tenkey_st) ;V1.24
@BBS (F_DPIN,tenkey_st) ;V1.24
ld a,(PRE_KEY) ;V1.52
ld (PRE_KEY_BK),a ;V1.52 this only is used for [IC] after ten key entry
@SEB (F_TNKEY) ;V1.07
ld a,(TEN_CT)
j z,tenkey_00 ;first tenkey entry?(TEN_CT=0) yes ->
tenkey_st: ;V1.24
ld a,(TEN_CT) ;v1.24
;V1.21 cmp a,MAX_DIGIT
push wa ;V1.21
@BBC (M14,tenkey_x) ;v1.21
pop wa ;V1.21
cmp a,14 ;V1.21
jp tenkey_z ;V1.21
tenkey_x: ;V1.21
@BBS (M10,tenkey_y)
pop wa ;V1.21
cmp a,12 ;V1.21
jp tenkey_z ;V1.21
tenkey_y:
pop wa ;V1.21
cmp a,10 ;V1.21
tenkey_z: ;V1.21
j lt,tenkey_01 ;tenkey over flow? no ->
ld b,0 ;V3.05
jp tenkey_01 ;V3.07
j no_operation ; over -> ignore current key
tenkey_00:
call ten_clear
call spc_dt ;clear #/D key buffer
ld (DT_CT),0 ;clear #/D data entry counter
ld (DT_DOT_CNT),0 ;V1.06
tenkey_01:
ld b,0 ;V3.07
ld a,(KEYIN) ;check key code
cmp a,K_ZERO ;0 key?
j ne,tenkey_02 ;no ->
ld b,0 ;yes -> set no loop
j tenkey_04
tenkey_02:
cmp a,K_ZERO2 ;00 key?
j ne,tenkey_03 ;no ->
ld b,1 ;yes -> set loop 2times
j tenkey_04
tenkey_03:
cmp a,K_ZERO3
j ne,tenkey_06 ;000 key? no ->
ld b,2 ;yes -> set loop 3times
tenkey_04:
ld (KEYIN),K_ZERO ;00,000 key yes->over write 0 to key code
@BBS (F_DPIN,tenkey_08) ;if DP entered? yes skip first zero entry check
cmp (TEN_CT),0 ;is it first zero entry?
j ne,tenkey_08 ; no ->
;V3.06 cmp (DT_CT),0 ;V1.27
;V3.06 j ne,tenkey_19 ;V1.27
tenkey_04x:
ld w,(KEYIN) ;V3.10 ;w <- tenkey data
call dt_update ;V3.10 ;DT_BUF update for #/D print
dec b ;V3.10 ;check loop counter
j f,tenkey_04x ;V3.10 ;if b is FFh? yes -> exit
jp tenkey_19 ;V3.10
tenkey_06:
;V3.07 ld b,0 ;not 00,000 key -> set no loop
tenkey_08:
@BBS (M14,tenkey_08x) ;V4.06
cmp (TEN_CT),12 ;V3.07
jp tenkey_09 ;V4.07
tenkey_08x: ;V4.07
cmp (TEN_CT),14 ;V4.06
tenkey_09: ;V4.06
j ge,tenkey_10 ;V3.07
ld hl,TENKEY
call stg_sfl47 ;TENKEY left shift by nibble
ld a,(TEN_LSD)
or a,(KEYIN)
ld (TEN_LSD),a
inc (TEN_CT) ;increment tenkey counter
inc (DT_CHR_CNT) ;V1.06
@BBC (F_DPIN,tenkey_10)
inc (TEN_DP) ;increment DP counter
tenkey_10:
ld w,(KEYIN) ;w <- tenkey data
call dt_update ;DT_BUF update for #/D print
tenkey_11:
dec b ;check loop counter
j t,tenkey_19 ;if b is FFh? yes -> exit
;V3.07 push wa ;V1.21
;V3.07 @BBC (M14,tenkey_10x) ;V1.21
;V3.07 cmp (TEN_CT),14 ;V1.21
;V3.07 jp tenkey_10z ;V1.21
;V3.07tenkey_10x: ;V1.21
;V3.07 @BBS (M10,tenkey_10y) ;V1.21
;V3.07 cmp (TEN_CT),12 ;V1.21
;V3.07 jp tenkey_10z ;V1.21
;V3.07tenkey_10y: ;V1.21
;V3.07 cmp (TEN_CT),10 ;V1.21
;V3.07tenkey_10z: ;V1.21
;V3.07 pop wa ;V1.21
;V3.10 j lt,tenkey_08 ; loop if not tenkey overflow(in case of 00,000 key)
jp tenkey_08 ;V3.10
tenkey_19:
j tenkey_end
;sub routine for #/D.........................
;input: reg.w <- entry data
dt_update:
ld a,(DT_CT)
@IS_LTP_OFF(dt_upd3) ;V4.07
cmp a,MAX_DIGIT_DT ;
jp dt_upd4 ;V4.07
dt_upd3: ;V4.07
cmp a,18 ;V4.07
dt_upd4: ;V4.07
j ge,dt_upd9 ;#/D entry over flow? yes-> doesn't keep current data (just count up DT_CT)
ld hl,DT_BUF
call stg_sfl49 ;DT_BUF left shift by nibble
ld a,(DT_BUF_LSD)
or a,w ;store entry data(reg.w)
ld (DT_BUF_LSD),a
j dt_upd8
dt_upd5:
;V3.01 cmp w,C_DP
;V3.01 j eq,dt_upd9 ;in case DP entry? yes-> doesn't count up DT_CT
dt_upd8:
inc (DT_CT) ;increment #/D entry counter
dt_upd9:
ret
;===============================================================================
; DP
;===============================================================================
dp_key:
@BBS (F_TNKEY,dp_key_00) ;V3.12;V1.24;V3.11
@SEB (F_TNKEY) ;V1.07
ld a,(TEN_CT)
j nz,dp_key_00 ;first DP key entry?(TEN_CT=0)
call ten_clear ;yes -> clear TENKEY
;V3.12 inc (TEN_CT)
ld a,(PRE_KEY) ;V1.52
ld (PRE_KEY_BK),a ;V1.52 this only is used for [IC] after ten key entry
dp_key_00:
cmp (TEN_CT),0 ;V3.12
j nz,dp_key_01 ;V3.12 ;first DP key entry?(TEN_CT=0)
inc (TEN_CT) ;V3.12
dp_key_01: ;V3.12
@SEB (F_TNKEY) ;V1.36
@SEB (F_DPIN)
;for update #/D entry.............
ld a,(DT_CT)
j nz,dp_key_02 ;first DP key entry?
call spc_dt ;clear #/D key buffer
;V3.01 jp dp_key_09 ;V1.07
;V1.32 jp dp_key_080 ;V1.32
dp_key_02:
;V3.01 ld a,(DT_BUF_LSD) ;V1.06
;V3.01 and a,0x0f ;V1.06
;V3.01 cmp a,C_DP ;V1.06
;V3.01 j eq,dp_key_09 ;V1.06
;V3.01 cmp (DT_DOT_CNT),4 ;V1.06
;V3.01 j ge,dp_key_09 ;V1.06
;V3.01 cmp (DT_CHR_CNT),2 ;V1.06
;V3.01 j ge,dp_key_08 ;V1.06
;V3.01 ld hl,DT_BUF ;V1.06
;V3.01 call stg_sfl49 ;V1.06
;V3.01 ld a,(DT_BUF_LSD) ;V1.06
;V3.01 swap a ;V1.06
;V3.01 cmp (DT_DOT_CNT),0 ;V1.06
;V3.01 j ne,dp_key_07 ;V1.06
;V3.01 or a,0xc0 ;V1.06 dot replace "0"
dp_key_07: ;V1.24
;V3.01 or a,0xd0 ;V1.24 "D" replace "0", will be return to 0 when print
dp_key_071: ;V1.24
;V3.01 ld (DT_BUF_LSD),a ;V1.06
;V3.01 inc (DT_CT) ;V1.06
dp_key_08: ;V1.06
inc (DT_DOT_CNT) ;V1.06
dp_key_080: ;V1.07
ld w,C_DP ;w <- DP character
call dt_update ;DT_BUF update for #/D print
dp_key_09:
ld (DT_CHR_CNT),0 ;V1.06
j tenkey_end
;===============================================================================
; GT
;===============================================================================
gt_key:
;V1.23
;V3.14 ld hl,IC_G
;V3.14 call ic_to_icbk ;V1.22
;V3.14 ld (SYM),S_SPC ;V1.26
;V3.14gt_ic_print: ;V1.24
;V3.14 call ic_print
;V3.14 call gt_to_w2
;V3.14 call w2_to_w4 ;V1.22 for average calc
;V3.14 call gt_clear ;yes -> GT function
;V3.14 @CLB (ICON_GT) ;V1.18
;V3.14 ld hl,W2
;V3.14 call wk_round ;W2(GT value) rounding
;V3.14 ld (SYM),S_GT
;V3.14 @BBS (SW_EUROS,gt_key_gt_to_stasta) ;V1.24
;V3.14 ld (SYM),S_STASTA ;V1.24
;V3.14gt_key_gt_to_stasta: ;V1.24
;V3.14 call wk_print ;W2 print
;V3.14 call feed_1 ;1 line feed
;V3.14 j gt_key_2
;V3.14gt_key_0:
;V3.14 ld hl,W2
;V3.14 ld (SYM),S_GS
;V3.14 call wk_print ;W2 print
;V3.14gt_key_2:
;V3.14 call w2_to_ten ;for display accumulator value(W2)
;V3.14 @SEB (F_FNEABL) ;V1.09
j function_end
;===============================================================================
; CE/C
;===============================================================================
ce_key:
@CLB (F_COUNTRY) ;V3.04
@CLB (EURO_PROG) ;V3.04
@CLB (RATE_PROG) ;V3.04
@BBS (F_TNKEY,ce_key_start) ;V1.30
@BBS (F_RATE,ce_key_start) ;V3.04
@IS_5514_OFF(ce_key_x) ;V4.12
call ten_zerock ;V4.12
j nz,ce_key_x ;V4.12
test (TEN_S).0 ;V4.12
j f,ce_key_start ;V4.12
ce_key_x: ;V4.12
ld a,(PRE_KEY) ;V1.30
ld (KEYIN),a ;V1.30
jp no_operation ;V1.30
ce_key_start:
ld (KEYIN),K_CE ;V1.13
jp cec_key_yyy ;V1.13
cec_key:
@CLB (F_COUNTRY) ;V3.04
@BBS (SW_AC,cec_key_0) ;V1.17
@BBC (F_TNKEY,cec_key_0)
cec_key_yyy: ;V1.13
ld (DT_CHR_CNT),0 ;V1.31
call ten_clear ;clear key entry only
call spc_dt ;clear #/D key buffer
j cec_key_2 ;-> function_end
;clear function.........
cec_key_0:
;; call all_clear ;h/w initialize, work area clear
call work_clear_acc ; no h/w initialize
ld hl,ACC
ld (SYM),S_CLR
call wk_print ;accumulator value(zero) print
call feed_1 ;1 line feed
@CLB (IC_PROG) ;V1.23
jp function_end ;V1.10
cec_key_2:
;V4.01 @CLB (IC_PROG) ;V1.23
j function_end_0
all_clear:
;h/w initialize...........
@BBS (IO_MT,all_clear) ;if motor moving? yes ->loop
;V4.01 @CLB (IC_PROG) ;V1.23
call init_vft ;V2.01
di
call init_io ;IO initialize
;V3.00 call init_pf ;initialize Timer3 for power failure detection
call init_scan ;initialize Timer4 for key scan
ei ;interrupt enable
;work area clear..........
work_clear_acc:
call acc_clear
work_clear:
call ten_clear
call spc_dt ;clear #/D key buffer
;V3.00 call fn_register_clear ;V1.13
;V3.00 ld (FINANCE_0),0 ;V1.09
;V3.00 ld (FINANCE_1),0 ;V1.09
ld (FLG_E),0y00000000 ;clear calculate instruction flag
ld (FLG_C),0y00000000 ;clear constant calculation flag
ret
;===============================================================================
; -
;===============================================================================
acc_minus:
;V4.01 @BBS (IC_PROG,set_ic_minus_key) ;V1.23 for V15 logic
;V4.01 cmp (PRE_KEY),K_M2CAL ;V1.22\
;V4.01 j ne,acc_minus_start ;V1.22|for [M2-]
;V4.01 ld (KEYIN),K_M2MI ;V1.22|
;V4.01 jp mem2_minus ;v1.22/
acc_minus_start: ;V1.22
;V3.00 @BBC (SW_V15,acc_minus_x) ;V1.19\
;V3.00 cmp (PRE_KEY),K_TAX ;V1.19|
;V3.00 j ne,acc_minus_x ;V1.19|
;V3.00 @BBC (M_TX2,acc_minus_tx1) ;V1.19|for V15 tax[-]
;V3.00 @BBC (M_TX1,acc_minus_tx0) ;V2.07
;V3.00 ld (KEYIN),K_TX12M ;V2.07
;V3.00 jp tax12_minus ;V2.07
;V3.00acc_minus_tx0:
;V3.00 ld (KEYIN),K_TX2M ;V1.19|
;V3.00 jp tax_minus_a ;V2.18
;V3.00acc_minus_tx1: ;V1.19|
;V3.00 ld (KEYIN),K_TXM ;V1.19|
;V3.00 jp tax_minus_a ;V1.19/v2.19
;------------------------------------------------------above for V15 logic
acc_minus_x:
@BBS (EURO_PROG,eurate_minus_key) ;\is euro rate setting mode?
@BBS (RATE_PROG,no_operation) ;/
acc_minus_y: ;V1.16
;V4.01 @BBC (SW_SGT,acc_minus_z) ;V1.25
acc_minus_z:
@SEB (F_MIN_TRA)
;V4.13 jp acc_plus_x ;V1.31
;===============================================================================
; +
;===============================================================================
acc_plus:
;V4.01 @BBS (IC_PROG,set_ic_plus_key) ;V1.23
;V4.01 cmp (PRE_KEY),K_M2CAL ;V1.22\
;V4.01 j ne,acc_plus_start ;V1.22|for [M2+]
;V4.01 ld (KEYIN),K_M2PL ;V1.22|
;V4.01 jp mem2_plus ;v1.22/
acc_plus_start: ;V1.22
;V3.00 @BBC (SW_V15,acc_plus_x) ;V1.19\
;V3.00 cmp (PRE_KEY),K_TAX ;V1.19| wait for [+] or [-] for [TAX+] or [TAX-] function
;V3.00 j ne,acc_plus_x ;V1.19|
;V3.00 @BBC (M_TX2,acc_plus_tx1) ;V1.19|
;V3.00 @BBC (M_TX1,acc_plus_tx0) ;V2.07
;V3.00 ld (KEYIN),K_TX12P ;V2.07
;V3.00 jp tax12_plus ;V2.07
;V3.00acc_plus_tx0:
;V3.00 ld (KEYIN),K_TX2P ;V1.19|
;V3.00 jp tax_plus_a ;V1.19|
;V3.00acc_plus_tx1: ;V1.19|
;V3.00 ld (KEYIN),K_TXP ;V1.19|
;V3.00 jp tax_plus_a ;V1.19/v2.19
;V2.19 jp tax_plus_x ;V2.18
;------------------------------------------------------- above for V15 logic
acc_plus_x: ;V1.19
;V4.12 @BBS (EURO_PROG,eurate_plus_key) ;\is euro rate setting mode?
@BBS (RATE_PROG,no_operation) ;/
acc_plus_y: ;V1.16
;V4.01 @BBC (SW_SGT,acc_plus01) ;V1.17 [+]/[-] have function for [+=]/[-=]?
;-------------------------------------------------------------------
acc_plus_z:
;V4.01 ld a,(FLG_E) ;V1.17
;V4.01 and a,0y00000011 ;V1.17check E_MUL,E_DIV flags
;V4.01 j nz,acc_plus000 ;V1.17
;V4.01 @BBS (F_PEREXE,acc_plus01) ;V1.24
;V4.01 @BBC (SW_SGK,acc_plus01) ;V1.19
;V4.01 ld a,(FLG_C) ;V1.19
;V4.01 and a,0y00000011 ;V1.19
;V4.01 j z,acc_plus01 ;V1.19
;V4.01acc_plus000:
;V4.01 @BBC (E_MUP,acc_plus00001) ;V1.24
;V4.01 call equal_mup ;V1.24
;V4.01 jp acc_plus00099 ;V1.24
;V4.01acc_plus00001: ;V1.24
;V4.01 @BBC (E_DLT,acc_plus00002) ;V1.24
;V4.01 call equal_dlt ;V1.24
;V4.01 jp acc_plus00099 ;V1.24
;V4.01acc_plus00002: ;v1.24
;V4.01 call equal_sub ;V1.17
;V4.01 ld (FLG_C),0
;V4.01acc_plus00099:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -