⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basic_fn.asm

📁 calculator code ,use toshibaor nec LSI
💻 ASM
📖 第 1 页 / 共 5 页
字号:
S_PLS		equ	0x02		;' +'
S_MIN		equ	0x03		;' -'
S_SPC		equ	0x04		;'  '
S_SHD		equ	0x04	
S_SHP		equ	0x05		;' #'
S_TL		equ	0x06		;' T'
S_TLGT		equ	0x07		;TL G+
S_STAPL		equ	0x07
S_ST		equ	0x08		;' S'
S_MUL		equ	0x09		;' X'
S_DIV		equ	0x0a		;' '+waru
S_EQU		equ	0x0b		;' ='
S_AST		equ	0x0c		;' *'
S_AVR		equ	0x0c		;' *'
S_CLR		equ	0x0d		;'c '
S_MTL		equ	0x0e		;'MT'
S_MST		equ	0x0f		;'MS'
S_MPL		equ	0x10		;'M+'
S_MMI		equ	0x11		;'M-'
S_M2TL		equ	0x12		;'MIIT'
S_M2ST		equ	0x13		;'MIIS'
S_M2PL		equ	0x14		;'MII+'
S_M2MI		equ	0x15		;'MII-'
S_PER_K		equ	0x16		;' %'  for function key(in box)
S_PRDS		equ	0x17		;'-%'
S_PRAD		equ	0x18		;'+%'
S_DLTA_K	equ	0x19		;delta+' ' for function key(in box)
S_PRDL		equ	0x1a		;delta+'%'
S_DLAS		equ	0x1b		;delta+'*'
S_PRMU		equ	0x1c		;' %'
S_MKUP		equ	0x1d		;'MU'
;S_RVS		equ	0x1e		;' '+up/down allow
S_EUAS		equ	0x1e		;'Euro *'	V3.14

S_MTH		equ	0x1f		;M	V3.13
S_ROOT		equ	0x20		;'R '
S_TAX		equ	0x21		;'TX%'
;S_PRN		equ	0x22		;' S'
S_PAY		equ	0x22		;P	V3.13
S_EUR		equ	0x23		;'K '(fcR)
;S_EUM		equ	0x24		;'K-'
S_EUROS		equ	0x24		;'Euro'
S_EUEQ		equ	0x25		;'Euro ='
S_COST		equ	0x26		;'C '
S_SELL		equ	0x27		;' S'
S_MARG		equ	0x28		;'M%'
S_TAXA		equ	0x29		;' T'
S_ICG		equ	0x2a		;'G '
S_G		equ	0x2a
S_ICM		equ	0x2b		;' M '
S_M		equ	0x2b
;V4.02S_LCL		equ	0x2c		;home+waru	1450TE V1.01
;V4.02S_LCAS		equ	0x2d		;home+*		1450TE V1.01
;V4.02S_FC		equ	0x2e		;euro+ x	1450TE V1.01
;V4.02S_FCAS		equ	0x2f		;euro+*		1450TE V1.01
S_DLTA		equ	0x2c;V4.020x30		;delta+' '
S_PER		equ	0x2d;V4.020x31		;delta+' '
;S_EQU_A	equ	;0x32		;
S_CPAY		equ	0x2e;V4.020x32		;P*	V3.13
S_TXPL		equ	0x2f;V4.020x33		;TX+
S_TXMI		equ	0x30;V4.020x34		;TX-
S_TLMGT		equ	0x31;V4.020x35		;TL M+
S_TX1PL		equ	0x32;V4.020x36		;TX1+
S_TX1MI		equ	0x33;V4.020x37		;TX1-
S_TX2PL		equ	0x34;V4.020x38		;TX2+
S_TX2MI		equ	0x35;V4.020x39		;TX2-
S_TAX1		equ	0x36;V4.020x3a		;T1%
S_TAX2		equ	0x37;V4.020x3b		;T2%
;V4.02S_GPM		equ	0x3c		;GPM(MU)
;V4.02S_GS		equ	0x3d
;V4.02S_GT		equ	0x3d		;GT
;V4.02S_GPL		equ	0x3e		;G+  for sigama=% when TA mode	V2.11


S_STAMN		equ	0x55
S_STAS		equ	0x56
S_STASTA	equ	0x57


;V3.00S_GS		equ	0x0f		;G dia	GT subtotal
;V3.00S_GT		equ	0x10		;G *	GT total
;V3.00S_PRM		equ	0x11		;- %	percent minus
;V3.00S_PRP		equ	0x12		;+ %	percent plus
;V3.00S_DLP		equ	0x13		;d +	delta plus(for tax+)
;V3.00S_DLM		equ	0x14		;d -	delta plus(for tax-)
;V3.00S_AM		equ	0x15		;A M	time print
;V3.00S_PM		equ	0x16		;P M	time print
;V3.00S_CST		equ	0xb7;0x17		;C *	cost price
;V3.00S_SEL		equ	0x26;0x18		;S *	selling price
;V3.00S_MAR		equ	0xa1;0x19		;M %	margine %
;V3.00S_MU		equ	0xa2;0x1a		;M _	mark up
;V3.00S_MUD		equ	0x57;0x1b		;d *	delta of mark up
;V3.00S_SET		equ	0x27;0x1d		;_ *	for rate,time set(* only)
;V3.00S_SHD		equ	0x22;0x1c		;_ _	for #/D print(space)
;V3.00S_TLG		equ	0x93;0x0a		;G +	total key with GT position
;==============================================================================
;V3.00S_FED		equ	0x00		;fh+' '
;V3.00S_PWR		equ	0x17		;'C*'
;V3.00S_PLS		equ	0x01		;' +'
;V3.00S_MIN		equ	0x02		;' -'
;V3.00S_SPC		equ	0x00		;'  '
;V3.00S_SHP		equ	0x26		;' <>'
;V3.00S_TL		equ	0x22		;' *'
;V3.00S_TLGT		equ	0x3c		;'*+'
;V3.00S_TLMGT		equ	0x3d		;'*+'
;V3.00S_ST		equ	0x08		;' <>'
;V3.00S_MUL		equ	0x03		;' X'
;V3.00S_DIV		equ	0x04		;' /'
;V3.00S_EQU		equ	0x05		;' ='
;V3.00S_AST		equ	0x22		;' *'
;V3.00S_CLR		equ	0x07		;'c '
;V3.00S_MTL		equ	0x0e		;'M*'
;V3.00S_MST		equ	0x0d		;'M<>'
;V3.00S_MPL		equ	0x0b		;'M+'
;V3.00S_MMI		equ	0x0c		;'M-'
;V3.00S_M2TL		equ	0x10		;'G*'
;V3.00S_STASTA	equ	0x77	;'**' 
;V3.00S_M2ST		equ	0x0f		;'G<>'
;V3.00S_STAS		equ	0x76	;'*S'
;V3.00S_M2PL		equ	0x3e		;'G+'
;V3.00S_STAPL		equ	0x73	;'*+' 
;V3.00S_PLSTA		equ	0x37	;'+*'
;V3.00S_M2MI		equ	0x3f		;'G-'
;V3.00S_STAMN		equ	0x70	;'*-' 
;V3.00S_M2TLV		equ	0x97		;'G*'
;V3.00S_M2STV		equ	0x96		;'G<>'
;V3.00S_M2PLV		equ	0x3e		;'G+'
;V3.00S_M2MIV		equ	0x3f		;'G-'
;V3.00S_PER		equ	0x06		;' %'
;V3.00S_STAPER	equ	0x71		;'*%'
;V3.00S_PRDS		equ	0x01		;'-%'
;V3.00S_PRAD		equ	0x31		;'+%'
;V3.00S_DLTAL		equ	0x82		;delta+' '
;V3.00S_DLTA		equ	0x28		;' "+delta V1.26
;V3.00S_PRDL		equ	0x81		;delta+'%'
;V3.00S_DLAS		equ	0x87		;delta+'*'
;V3.00S_PRMU		equ	0x21		;' %'
;V3.00S_MKUP		equ	0xa2		;'M '
;V3.00S_RVS		equ	0x22		;'  '
;V3.00S_AVR		equ	0x27		;' *'
;V3.00S_ROOT		equ	0x22		;'  '
;V3.00S_TAX		equ	0x12		;'% '
;V3.00S_PRN		equ	0x62		;'<> '
;V3.00S_EUR		equ	0x22		;'  '
;V3.00S_EUEQ		equ	0xc2		;'= '
;V3.00S_COST		equ	0x2b		;' C'
;V3.00S_SELL		equ	0x26		;' <>'
;V3.00S_M		equ	0x2a		;' M'
;V3.00S_MARG		equ	0xa1		;'M%'
;V3.00S_PERMARG	equ	0x1a		;'%M'
;V3.00S_TAXA		equ	0x27		;' *'
;V3.00S_ICG		equ	0x29		;' G'
;V3.00S_ICGV		equ	0x29		;' G'
;V3.00S_ICM		equ	0x2a		;' M'
;V3.00S_ASM		equ	0x7a		;'*M'
;V3.00S_ASC		equ	0x7b		;'*C'
;V3.00S_ASDL		equ	0x78		;'*'+delta
;V3.00S_MIPL		equ	0x03		;'-+'	
;V3.00S_MIMI		equ	0x00		;'--'
;V3.00S_MIST		equ	0x06		;'-S'
;V3.00S_MITL		equ	0x07		;'-T'
;V3.00S_EUROS		equ	0x29		;' euro'
;V3.00S_G		equ	0x9f		;'G '
;V3.00S_GPL		equ	0x93		;'G+'
;V3.00S_GAST		equ	0x97		;'G*'
;==============================================================================
P_SPC	equ	0x20	;for print " "
;-----------------------------------------------------------
;interrupt enable flag set:

EF4		equ	4;(EIRL).4 /INT0
EF5		equ	5;(EIRL).5 INTTC1
EF6		equ	6;(EIRL).6 INT1
EF7		equ	7;(EIRL).7 INTTBT
EF8		equ	0;(EIRH).0 INTTC3
EF9		equ	1;(EIRH).1 INTSIO(High speed SIO interrupt)
EF10		equ	2;(EIRH).2 INTTC4
EF11		equ	3;(EIRH).3 INT3
EF12		equ	4;(EIRH).4 INT4
EF13		equ	5;(EIRH).5 INTTC2
EF14		equ	6;(EIRH).6 /INT5
EF15		equ	7;(EIRH).7 INTADC or INT2
;interrupt request flag set:
IL2		equ	2;(ILL).2 INTSWI 
IL3		equ	3;(ILL).3 INTATRAP
IL4		equ	4;(ILL).4 /INT0
IL5		equ	5;(ILL).5 INTTC1
IL6		equ	6;(ILL).6 INT1
IL7		equ	7;(ILL).7 INTTB
IL8		equ	0;(ILH).0 INTTC3
IL9		equ	1;(ILH).1 INTSIO
IL10		equ	2;(ILH).2 INTTC4
IL11		equ	3;(ILH).3 INT3
IL12		equ	4;(ILH).4 INT4
IL13		equ	5;(ILH).5 INTTC2
IL14		equ	6;(ILH).6 /INT5
IL15		equ	7;(ILH).7 INTADC or /INT2
;	DBR_LCD_RATE		equ	(0x0f33<<4)+5	;LCD DBR matrix point for "RATE"
;	DBR_LCD1235_RATE	equ	(0x0f33<<4)+3	;LCD DBR matrix point for "RATE"
;	DBR_LCD1297_RATE	equ	(0x0f33<<4)+4	;LCD DBR matrix point for "RATE"
;	DBR_LCD120_RATE		equ	(0x0f33<<4)+4	;LCD DBR matrix point for "RATE"
;	DBR_LCD1297_GT		equ	(0x0f32<<4)+2	;LCD DBR matrix point for "GT"
;	;LCD_PRN		equ	(0x0f31<<4)+3	;LCD DBR matrix point for "PRINT"
;	;LCD_FIN		equ	(0x0f30<<4)+3	;LCD DEB matrix point for "FIN"

AUTOOFFTIME	equ	31250;1500
	$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:
	ld	wa,F_RATE
	test	(F_RATE>>4).a		;bit -reverse-> jump status
	j	f,rate_ten_key		;if jump status is 0 -> branch
	ld	wa,F_TNKEY
	test	(F_TNKEY>>4).a		;bit -reverse-> jump status
	j	f,tenkey_st		;if jump status is 0 -> branch
	ld	wa,F_DPIN
	test	(F_DPIN>>4).a		;bit -reverse-> jump status
	j	f,tenkey_st		;if jump status is 0 -> branch
		ld	a,(PRE_KEY)	;V1.52
		ld	(PRE_KEY_BK),a	;V1.52 this only is used for [IC] after ten key entry
	ld	wa,F_TNKEY
	set	(F_TNKEY>>4).a
		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
	ld	wa,M14
	test	(M14>>4).a		;bit -reverse-> jump status
	j	t,tenkey_x		;if jump status is 1 -> branch
		pop	wa		;V1.21
		cmp	a,14		;V1.21
		jp	tenkey_z	;V1.21
tenkey_x:				;V1.21
	ld	wa,M10
	test	(M10>>4).a		;bit -reverse-> jump status
	j	f,tenkey_y		;if jump status is 0 -> branch
		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
	ld	wa,F_DPIN
	test	(F_DPIN>>4).a		;bit -reverse-> jump status
	j	f,tenkey_08		;if jump status is 0 -> branch
		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:
	ld	wa,M14
	test	(M14>>4).a		;bit -reverse-> jump status
	j	f,tenkey_08x		;if jump status is 0 -> branch
		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
	ld	wa,F_DPIN
	test	(F_DPIN>>4).a		;bit -reverse-> jump status
	j	t,tenkey_10		;if jump status is 1 -> branch
		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)
	test	(FLG_MODE).0
	j	t,dt_upd3
		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:
	ld	wa,F_TNKEY
	test	(F_TNKEY>>4).a		;bit -reverse-> jump status
	j	f,dp_key_00		;if jump status is 0 -> branch
	ld	wa,F_TNKEY
	set	(F_TNKEY>>4).a
		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
	ld	wa,F_TNKEY
	set	(F_TNKEY>>4).a
	ld	wa,F_DPIN
	set	(F_DPIN>>4).a
;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:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -