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

📄 main.asm

📁 calculator code ,use toshibaor nec LSI
💻 ASM
📖 第 1 页 / 共 4 页
字号:


;clear all error flags.......
error_clr:
	ld	wa,F_ZDIVER
	clr	(F_ZDIVER>>4).a
	ld	wa,F_CALER
	clr	(F_CALER>>4).a
	ld	wa,ICON_E
	clr	(ICON_E>>4).a
		ret
;===============================================================================
;		Check mode key (ON-OFF,RATE-OFF,NP-PRN)
;===============================================================================
T_NPJG		equ	30				;7813us x 30 = 234.4ms (the value for judge NP -> P)
;T_NPJG		equ	20				;7813us x 20 = 156.3ms (the value for judge NP -> P)

check_mdsw:
;V4.11		@BBS	(F_OFF,check_md12)
;under ON condition........
;V4.11		@BBC	(SW_OFF_RT,check_md14)		;power sw move to OFF? no->
;V4.11		cmp	(KEY_CT),0			;KEY_CT=0?
;V4.11		j	ne,check_md14			;no -> not allow to enter OFF mode
;get into OFF mode(ON->OFF).....
;V4.11		@SEB	(F_OFF)				;
;V4.11		@SEB	(F_DOFF)	;V2.05
;V4.11		@CLB	(IC_PROG)	;
;V3.00		@CLB	(RTC_ON)	;V1.44
;V3.00		@CLB	(RTC_SET)	;V1.44
;V3.00		@CLB	(RTC_CHK)	;V2.12
;V4.11		@CLB	(F_ICDSP)	;V1.44
;V4.11		@CLB	(F_KON)		;V1.47
;V4.11		@CLB	(F_KOFF)	;V1.47
check_md11:
;V4.11		@BBS	(IO_MT,check_md11)		;if motor moving?  yes ->loop
;V4.11		call	wait_50ms			;
;V4.11		call	vft_disable		;2.01
;V4.11		j	check_md99			; -> for clear RTC display mode
;under OFF condition........
check_md12:
;V4.11		@BBS	(SW_OFF_RT,check_md99)		;under OFF mode(and power sw off)  yes-> ignore other sw update
;wake up(OFF->ON)............
check_md13:
;V4.11		ld	(DELAY_CT),T_NPJG			;set timer for judge OFF -> ON mode
;V4.11		call	wait_xms			;wait a morment(T_NPJG)

;------------------------------------------------
;V4.11		ld	sp,RAM_BOT	;V1.39b	;because this subroutine, only recalled in main routine 
;V4.11		jp	resume		;V1.24
;------------------------------------------------
check_md14:
;V3.00		@BBC	(SW_FIN_RT,check_md15)	;V1.17
;V3.00		@BBS	(M_FINANCE,check_md16)	;V1.20
;V3.00		@SEB	(M_FINANCE)		;V1.17
;V3.00		j	check_md99		;V1.36
check_md15:					;V1.17
;v3.00		@BBC	(M_FINANCE,check_md16)	;V1.20
;V3.00		@CLB	(M_FINANCE)		;V1.19
;V3.00		ld	(FINANCE_0),0	;V1.36
;V3.00		ld	(FINANCE_1),0	;V1.36
;V3.00		j	check_md99		;V1.36
check_md16:					;V1.20
;V3.00		@BBC	(RTC_ON,check_md18_1)	;V1.30
;V3.00		@BBC	(SW_DMY_RT,check_md17)	;V1.21
;V3.00		@BBS	(RTC_DMY,check_md17_1)	;V1.21
;V3.00		@SEB	(RTC_DMY)		;V1.21
;V3.00		call	rtc_edit_d		;RTC data edit and transfer to DISP
;V3.00		call	disp_to_dbr		;DBR update (DISP -> DBR)
;V3.00		jp	check_md39		;V1.21
check_md17:					;V1.21
;V3.00		@BBC	(RTC_DMY,check_md17_1)	;V1.21
;V3.00		@CLB	(RTC_DMY)		;V1.21
;V3.00		call	rtc_edit_d		;RTC data edit and transfer to DISP
;V3.00		call	disp_to_dbr		;DBR update (DISP -> DBR)
;V3.00		jp	check_md39		;V1.21
check_md17_1:					;V1.21
;V3.00		@BBC	(SW_24_RT,check_md18)	;V1.21
;V3.00		@BBS	(RTC_24,check_md18_1)	;V1.21
;V3.00		@SEB	(RTC_24)		;V1.21
;V3.00		call	rtc_edit_d		;RTC data edit and transfer to DISP
;V3.00		call	disp_to_dbr		;DBR update (DISP -> DBR)
;V3.00		jp	check_md39		;V1.21
check_md18:					;V1.21
;V3.00		@BBC	(RTC_24,check_md18_1)	;V1.21
;V3.00		@CLB	(RTC_24)		;V1.21
;V3.00		call	rtc_edit_d		;RTC data edit and transfer to DISP
;V3.00		call	disp_to_dbr		;DBR update (DISP -> DBR)
check_md18_1:					;V1.21
	ld	wa,P_ERR
	test	(P_ERR>>4).a		;bit -reverse-> jump status
	j	f,check_md99		;if jump status is 0 -> branch
	ld	wa,P_NP
	test	(P_NP>>4).a		;bit -reverse-> jump status
	j	f,check_md22		;if jump status is 0 -> branch
;under print condition........
	ld	wa,SW_NP_RT
	test	(SW_NP_RT>>4).a		;bit -reverse-> jump status
	j	t,check_md24		;if jump status is 1 -> branch
	ld	wa,P_NP
	set	(P_NP>>4).a
		j	check_md24
;under non print condition........
check_md22:
;V1.32		@BBS	(SW_NP_RT,check_md25)
	ld	wa,SW_NP_RT
	test	(SW_NP_RT>>4).a		;bit -reverse-> jump status
	j	f,check_md24		;if jump status is 0 -> branch
		ld	(DELAY_CT),T_NPJG			;set timer for judge NP -> OFF mode
		call	wait_xms			;wait a morment(T_NPJG)
	ld	wa,P_NP
	clr	(P_NP>>4).a
;V4.11		@BBS	(SW_OFF_RT,check_md25)
		call	update_md		;V1.30
;V3.01		ld	(SYM),S_SPC	;V1.30
;V3.01		ld	hl,IC_A		;V1.30
;V3.01		call	ic_print	;V1.30
;V3.01		ld	(SYM),S_ST	;V1.03
;V3.01		ld	hl,ACC		;V1.03
;V3.01		call	wk_round	;V1.26
;V3.01		call	wk_print	;V1.03	
;V3.05		@CLB	(F_TNKEY)	;V1.30
;V3.05		@CLB	(F_DPIN)	;V1.30
;V3.05		@CLB	(F_RATE)
;V3.05		@CLB	(EURO_PROG)
;V3.05		@CLB	(RATE_PROG)
;V3.05		@CLB	(F_ICDSP)	;V2.10
;V3.05		@CLB	(IC_PROG)	;V2.10
;V3.05		@CLB	(F_DPIN)
;V3.05		@CLB	(F_MIN_TRA)
;V3.00		@CLB	(RTC_ON)	;V1.52
;V3.00		@CLB	(RTC_CHK)	;V1.52
;V3.00		@CLB	(RTC_SET)	;v1.52
;V3.05		ld	(DT_DOT_CNT),0
;V3.05		ld	(DT_CHR_CNT),0
;V3.05		ld	(TEN_CT),0	;V1.30
;V3.05		ld	(DT_CT),0	;V1.30
;V3.05		ld	(PRE_KEY),0xff	;V1.35
;V3.01		call	acc_to_w2	;V1.17
;V3.01		call	w2_to_ten	;V1.17
;V3.01		ld	hl,TENKEY	;V1.17
;V3.01		call	edit_disp	;V1.17
;V3.01		call	disp_to_dbr	;V1.17
		call	feed_1
		j	check_md99	;V3.05
;V1.35		j	check_md39			;for printer error check
		;-----------------------------------------------
		ld	sp,RAM_BOT	;V1.39b;because this subroutine, only recalled in main routine 
		jp	function_end9	;V1.44
		;-----------------------------------------------
check_md24:
	ld	wa,F_KON
	test	(F_KON>>4).a		;bit -reverse-> jump status
	j	f,check_md25		;if jump status is 0 -> branch
	ld	wa,PAPER_FEED
	test	(PAPER_FEED>>4).a		;bit -reverse-> jump status
	j	t,check_md25		;if jump status is 1 -> branch
	ld	wa,SW_FEED_RT
	test	(SW_FEED_RT>>4).a		;bit -reverse-> jump status
	j	f,check_md24_1		;if jump status is 0 -> branch
	ld	wa,PAPER_FEED
	test	(PAPER_FEED>>4).a		;bit -reverse-> jump status
	j	f,check_md24_1		;if jump status is 0 -> branch
		call	wait_50ms			;V1.39
	ld	wa,PAPER_FEED
	test	(PAPER_FEED>>4).a		;bit -reverse-> jump status
	j	t,check_md25		;if jump status is 1 -> branch
check_md24_1:					;V1.24
		call	kfeed_1			;V1.32
;V4.08		@SEB	(F_REVCAN)		;V4.08
;V4.08		call	feed_1			;V4.08
;v3.00		@BBC	(RTC_ON,check_md24_2)	;V1.44;V2.10
;V3.00		@BBS	(RTC_CHK,check_md24_2)	;V2.10
;V3.00		call	rtc_edit_d		;V1.44;V2.10
;V3.00		call	disp_to_dbr		;V1.44;V2.10
check_md24_2:;V2.09
		j	check_md99	;V1.27
check_md25:
	ld	wa,PAPER_FEED
	clr	(PAPER_FEED>>4).a
	ld	wa,SW_FEED
	clr	(SW_FEED>>4).a
	ld	wa,SW_FEED_RT
	clr	(SW_FEED_RT>>4).a
	ld	wa,F_TNKEY
	test	(F_TNKEY>>4).a		;bit -reverse-> jump status
	j	t,check_md99		;if jump status is 1 -> branch
	ld	wa,DP_UPDATE
	test	(DP_UPDATE>>4).a		;bit -reverse-> jump status
	j	t,check_md99		;if jump status is 1 -> branch
	ld	wa,DP_UPDATE
	clr	(DP_UPDATE>>4).a
		jp	check_md99	;V1.19
;exit point of OFF, RATE key are moved.........
check_md33:
		call	error_clr			;clear F_ZDIVER, F_CALER, ICON_E
;V3.00		@CLB	(RTC_ON)			;clear RTC display mode when wakeup
;V3.00		@CLB	(RTC_SET)			;clear RTC set mode when wakeup
		ld	(KEYIN),0			;clear current key code for clear PRE_KEY
		ld	(TEN_CT),0			;V105 for clear tenkey entry status
		ld	(DT_CT),0			;V105 #/D entry counter
		ld	(DT_DOT_CNT),0	;V1.06
		ld	(DT_CHR_CNT),0	;V1.06
	ld	wa,F_DPIN
	clr	(F_DPIN>>4).a
	ld	wa,F_MIN_TRA
	clr	(F_MIN_TRA>>4).a
;		jp	check_md99	;V1.20
;exit point for NP->P(not clear tenkey status.........
check_md39:
;V3.00		@BBS	(RTC_ON,check_md99)	;V1.29
check_md39a:					;V1.36
		set	cf				;C=1: update display and printer error check 
		ret
check_md99:
		clr	cf				;C=0: normal exit
		ret

;===============================================================================
;		check entry key for tax rate set mode
;===============================================================================
check_rtent:
	ld	wa,F_RATE
	test	(F_RATE>>4).a		;bit -reverse-> jump status
	j	t,check_rte91		;if jump status is 1 -> branch
		ld	b,(KEYIN)
		cmp	b,K_TEN				;if key code is Tenkey,00 or 000?
		j	le,check_rte90			;yes -> through
		cmp	b,K_DP				;DP key?
		j	eq,check_rte90			;yes -> through
		cmp	b,K_CEC				;CE/C key?
		j	eq,check_rte02			;yes -> 
		cmp	b,K_BS				;BS key?
		j	eq,check_rte03			;yes ->
		j	check_rte98			;others are not allowd
;check for CE/C key...
check_rte02:
	ld	wa,F_RTUPD
	test	(F_RTUPD>>4).a		;bit -reverse-> jump status
	j	f,check_rte03		;if jump status is 0 -> branch
		ld	(TEN_CT),1			;just store 1 to TEN_CT for it is worked CE function(for avoid Clear function)
		j	check_rte90			; -> allow current key entry
check_rte03:
		cmp	(TEN_CT),0			;with tenkey entry?
		j	ne,check_rte90			;yes -> through
		j	check_rte98			;if no tenkey  -> not allowed

check_rte90:
	ld	wa,F_RTUPD
	set	(F_RTUPD>>4).a
check_rte91:
		set	cf				;OK: set CF (means current key allowed)
		ret
check_rte98:
		clr	cf				;NG: clear CF (means current key not allowed) 
		ret

;===============================================================================
;		IO port initialize
;===============================================================================
init_io:		
	ld	(P0CR),0y11111100	;\P00P01 NC, P02:STB2,P03:STB1, P04:LAT, P05P06P07:EEPROM DI/O SK CS
	ld	(P0DR),0y00011100	;/

	ld	(P1DR),0y11111111	;\
	ld	(P1PRD),0y00000000	;|P16:P/H DI, P17:P/H SCK, others key return
	ld	(P1OUTCR),0y11000000	;/
	ld	(TC3SEL),0

	ld	(P2DR),0y00000111	;\P20 PF, P21 Xin, P22 Xout
	ld	(P2PRD),0y00000000	;/

	ld	(P3DR),0y11111111	;\NC
	ld	(P3PRD),0y00000000	

	ld	(P4CR1),0y01111100	;\P40:TM AD, P41:VPR AD
	ld	(P4CR2),0y11111100	;|P42:VPR control, P43:ENA2, P44:ENA1, P45:IN1, P46:IN2 P47:NC
	ld	(P4DR),0y10000000	;/

	ld	(P5DR),0y00000000	;P50~P53 slid return
	ld	(P5CR),0y00000000	;

	ld	(P6DR),0y00000000	;to VFD

	ld	(P7DR),0y00000000	;to VFD

	ld	(P8DR),0y00000000	;to VFD

	ld	(P9DR),0y00000000	;key scan output

	ld	(PDDR),0y00000000	;NC

	ld	(ADCCR1),0y00000000	;\A/D convert disable
	ld	(ADCCR2),0y00000000	;/

	ld	(STOPCR),0y00000000	;no STOP mode will be used
	ret
;===============================================================================
		;----------------------------------------V1.37
rate_init_flag_print:
		call	spc_prnbuf			;V1.37
		ld	ix,PRN_BUF_MSD_LTP			;V1.37
	test	(FLG_MODE).0
	j	f,rate_int_print_0
		ld	ix,PRN_BUF		;V4.03
rate_int_print_0:				;V4.03
		ld	iy,initial_print_work_tbl
	rate_int_print_1:				;V1.37
		ld	a,(iy)
		ld	(ix),a			;V1.37
		inc	ix			;V1.37
		inc	iy
	test	(FLG_MODE).0
	j	f,rate_int_print_1x
		cmp	iy,initial_print_work_tbl_end
		jp	rate_int_print_1y
rate_int_print_1x:					;V4.05
		cmp	iy,initial_print_work_tbl_end_LTP	;V4.05
rate_int_print_1y:
		j	lt,rate_int_print_1		;V1.37
		call	print_bk			;V1.37
		call	feed_1
		;------------------------------------------V1.37
		ret					;V1.39b
initial_print_work_tbl: ;out print: RATE INITIALZED
	db	ps_r,ps_a,ps_t,ps_e,ps_spc,ps_i,ps_n,ps_i,ps_t,ps_i,ps_a,ps_l,ps_i,ps_z,ps_e,ps_d,ps_dot,ps_dot
initial_print_work_tbl_end_LTP:
	db	ps_dot,ps_dot,ps_dot,ps_dot,ps_dot,ps_dot
initial_print_work_tbl_end:
;===============================================================================
obs_key_check:
		cmp	(KEYIN),K_PLS
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_MIN
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_MUL
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_DIV
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_DLT
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_IC
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_PER
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_ST
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_TL
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_MPL
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_MMI
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_MST
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_MTL
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_CST
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_SEL
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_MGR
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_SGN
		j	eq,obs_key_check_cs
		cmp	(KEYIN),K_DP
		j	eq,obs_key_check_cs
		clr	cf
		ret
obs_key_check_cs:
		set	cf
		ret
;===============================================================================
;		Jump address table for each function routin
;===============================================================================
tbl_function:;		key name   for summa20 mode	;table offset  key code
		dw	tenkey		;0-9-000	;+00		00~0b	0 ~ 9, 00,000
		dw	dp_key		;.		;+01		0c	DP
		dw	ce_key		;		;+02		0d	
		dw	cec_key		;C/CE/ON	;+03		0e	CE/C
		dw	gt_key		;		;+04		0f	GT
		dw	acc_plus	;+		;+05		10	+
		dw	acc_minus	;-		;+06		11	-
		dw	acc_subtl	;#/ST/T		;+07		12	S
		dw	acc_total	;		;+08		13	T
		dw	tax2_plus	;		;+09		14	
		dw	tax2_minus	;		;+0a		15
		dw	equal_key	;=		;+0b		16	=
		dw	percent_key	;%/amount key	;+0c		17	%
		dw	multi_key	;X		;+0d		18	x
		dw	divide_key	;/		;+0e		19	Div
		dw	markup_key	;MU/amount	;+0f		1a	MU
		dw	delta_percent	;		;+10		1b	delta%
		dw	sign_change	;		;+11		1c	+/-
		dw	back_space	;		;+12		1d	BS
		dw	sharp_date	;		;+13		1e	#/D
		dw	item_key	;		;+14		1f	
		dw	mem_plus	;M+/payment	;+15		20	M+	
		dw	mem_minus	;m-/month	;+16		21	M-	
		dw	mem_subtl	;MRC/interest	;+17		22	MS	
		dw	mem_total	;Mt/amount	;+18		23	MT	
		dw	cost_key	;		;+19		24	FEED	
		dw	sell_key	;		;+1a		25
		dw	margin_key	;		;+1b		26
		dw	square_root	;square		;+1c		27
		dw	rate_key	;RATE		;+1d		28
		dw	tax_plus	;TAX+		;+1e		29	TAX+
		dw	tax_minus	;TAX-		;+1f		2a	TAX-
		dw	perplus_key	;time_key	;+20		2b	
		dw	euro_key	;EURO/M2+	;+21		2c	COST
		dw	local_key	;LOCAL/M2-	;+22		2d	SELL
		dw	mem2_subtl	;V2.03off_key		;OFF/M2ST	;+23		2e	MARGIN
		dw	mem2_total	;V2.03feed_key	;FED/M2T	;+24		2f
end

⌨️ 快捷键说明

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