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

📄 printer.asm

📁 calculator code ,use toshibaor nec LSI
💻 ASM
📖 第 1 页 / 共 5 页
字号:
	ldw	(TC2DRL),STP_INIT			;set TC2DR
	ld	(TC2CR),0y00001110		;TC2CK(011)=fc/2^3 TC2S(0):stop TC2M(0):timer mode
	clr	(ILH).IL13		;clear TC6 request (ILH:bit4)
	set	(EIRH).EF13			;set TC6 enable (EIRH:bit4)
	ld	(TC2CR),0y00101110		;TC2CK(011)=fc/2^3 0.5us TC2S(1):start TC2M(0):timer mode
		j	timer_y_exit

ltp_timer_y_init:
		inc	(STEP_CT)
		cmp	(STEP_CT),16
		j	lt,ltp_timer_y_i2
		j	ne,ltp_timer_y_i0
	ld	wa,F_RVSE
	clr	(F_RVSE>>4).a
		j	ltp_timer_y_i2
ltp_timer_y_i0:
		cmp	(STEP_CT),34
		j	lt,ltp_timer_y_i2
	ld	wa,F_INIT
	clr	(F_INIT>>4).a
		j	ltp_timer_y_rush	;---> Motor stop Rush
ltp_timer_y_i2:
		call	phase_out
	ldw	(TC2DRL),STP_FEED_LTP			;set TC2DR
	ld	(TC2CR),0y00001110		;TC2CK(011)=fc/2^3 TC2S(0):stop TC2M(0):timer mode
	clr	(ILH).IL13		;clear TC6 request (ILH:bit4)
	set	(EIRH).EF13			;set TC6 enable (EIRH:bit4)
	ld	(TC2CR),0y00101110		;TC2CK(011)=fc/2^3 0.5us TC2S(1):start TC2M(0):timer mode
		j	timer_y_exit

;
;--------------------------------------------------------------------------------------
timer_y_feed:
		inc	(STEP_CT)
		ld	b,(STEP_CT)
;V3.09		@BBS	(SW_LTP,ltp_timer_y_feed)	;V3.08
		cmp	b,20+1			;10 dotline complete?
;V3.09		jp	ltp_timer_y_feed_1		;V3.08
ltp_timer_y_feed:
;V3.09		cmp	b,40+3+(L_FEED_LTP*2)+1			;V3.08
ltp_timer_y_feed_1:
		j	lt,timer_y_f10		;no
	ld	wa,F_FDREQ
	test	(F_FDREQ>>4).a		;bit -reverse-> jump status
	j	f,timer_y_f01		;if jump status is 0 -> branch
	ld	wa,F_FEED
	clr	(F_FEED>>4).a
	ld	wa,SW_LTP
	test	(SW_LTP>>4).a		;bit -reverse-> jump status
	j	f,ltp_timer_y_rush		;if jump status is 0 -> branch
		j	timer_y_rush		;---> Motor stop Rush
timer_y_f01:
		ld	(STEP_CT),1
		ld	b,234			;= STEP_CT
		j	timer_y_f22
timer_y_f10:
;V3.09		@BBS	(SW_LTP,timer_y_f10x)	;V3.08
		cmp	b,16+1			;8 dotline complete ?
		jp	timer_y_f10y
timer_y_f10x:
;V3.09		cmp	b,(40+3+(L_FEED_LTP*2)+1)*4/5	;V3.08
timer_y_f10y:
		j	ne,timer_y_f22		;no
	ld	wa,F_FDREQ
	clr	(F_FDREQ>>4).a
timer_y_f22:
;V4.16		j	ltp_timer_y_fed		;//test
	ld	wa,SW_LTP
	test	(SW_LTP>>4).a		;bit -reverse-> jump status
	j	f,ltp_timer_y_fed		;if jump status is 0 -> branch
		cmp	b,1			;STEP_CT=1 ?
		j	ne,timer_y_f25		;no
	ldw	(TC2DRL),STP_SLOW			;set TC2DR
		j	timer_y_f30
timer_y_f25:
	ldw	(TC2DRL),STP_FEED			;set TC2DR
timer_y_f30:
	ld	(TC2CR),0y00001110		;TC2CK(011)=fc/2^3 TC2S(0):stop TC2M(0):timer mode
	clr	(ILH).IL13		;clear TC6 request (ILH:bit4)
	set	(EIRH).EF13			;set TC6 enable (EIRH:bit4)
	ld	(TC2CR),0y00101110		;TC2CK(011)=fc/2^3 0.5us TC2S(1):start TC2M(0):timer mode
timer_y_f39:
		call	phase_out
		j	timer_y_exit

ltp_timer_y_fed:
	ldw	(TC2DRL),STP_FEED_LTP			;set TC2DR
	ld	(TC2CR),0y00001110		;TC2CK(011)=fc/2^3 TC2S(0):stop TC2M(0):timer mode
	clr	(ILH).IL13		;clear TC6 request (ILH:bit4)
	set	(EIRH).EF13			;set TC6 enable (EIRH:bit4)
	ld	(TC2CR),0y00101110		;TC2CK(011)=fc/2^3 0.5us TC2S(1):start TC2M(0):timer mode
		j	timer_y_f39
;
;--------------------------------------------------------------------------------------
timer_y_prn:
		;--------------------------------------------------------------
	ld	wa,SW_LTP
	test	(SW_LTP>>4).a		;bit -reverse-> jump status
	j	f,ltp_timer_y_prn		;if jump status is 0 -> branch
	ld	wa,F_RVSE
	test	(F_RVSE>>4).a		;bit -reverse-> jump status
	j	t,timer_y_p00		;if jump status is 1 -> branch
		inc	(STEP_CT)
		cmp	(STEP_CT),43		;21dot x2 step?
		j	lt,timer_y_p20
	ld	wa,F_RVSE
	clr	(F_RVSE>>4).a
		inc	(PHASE_CT)
		ld	(STEP_CT),0
		j	timer_y_rush	
		;--------------------------------------------------------------
timer_y_p00:
;		cmp	(STEP_CT),40+12		;20+6 dotline complete ?
	ld	wa,F_LPRN
	test	(F_LPRN>>4).a		;bit -reverse-> jump status
	j	f,timer_y_p00x0		;if jump status is 0 -> branch
	ld	wa,F_LARGP
	test	(F_LARGP>>4).a		;bit -reverse-> jump status
	j	f,timer_y_p00x		;if jump status is 0 -> branch
timer_y_p00x0:					;V4.07
		cmp	(STEP_CT),40+6+L_FEED	;20+n dotline complete ?
		jp	timer_y_p00y			;V4.03
timer_y_p00x:
		cmp	(STEP_CT),40+6+L_FEED+12	;V4.03 20+n dotline complete ?
timer_y_p00y:						;V4.03
		j	lt,timer_y_p08		;no
timer_y_p01:
;V4.07		@CLB	(F_LPRN)		;V4.07
;V3.00		@BBS	(RP_PRINT,timer_y_p012)	;auto replay print? yes-> no reverse mortion
	ld	wa,F_REVCAN
	test	(F_REVCAN>>4).a		;bit -reverse-> jump status
	j	t,timer_y_p015		;if jump status is 1 -> branch
timer_y_p012:
	ld	wa,F_PRREQ
	test	(F_PRREQ>>4).a		;bit -reverse-> jump status
	j	f,timer_y_p05		;if jump status is 0 -> branch
		j	timer_y_p017		;
timer_y_p015:
	ld	wa,F_EXFED
	test	(F_EXFED>>4).a		;bit -reverse-> jump status
	j	t,timer_y_p02		;if jump status is 1 -> branch
;		cmp	(STEP_CT),40+12+42	;20+6+21
	ld	wa,F_LPRN
	test	(F_LPRN>>4).a		;bit -reverse-> jump status
	j	f,timer_y_p015x0		;if jump status is 0 -> branch
	ld	wa,F_LARGP
	test	(F_LARGP>>4).a		;bit -reverse-> jump status
	j	f,timer_y_p015x		;if jump status is 0 -> branch
timer_y_p015x0:					;V4.07
		cmp	(STEP_CT),40+6+L_FEED+42	;20+6+21
		jp	timer_y_p015y			;V4.03
timer_y_p015x:						;V4.03
		cmp	(STEP_CT),40+6+L_FEED+42+12	;V4.03
timer_y_p015y:						;v4.03
		j	lt,timer_y_p03
		;--------------------------------------------------------------
timer_y_p017:				;1 line completed with feeding 1 line
	ld	wa,F_EXFED
	clr	(F_EXFED>>4).a
	ld	wa,F_PRINT
	clr	(F_PRINT>>4).a
;V4.07		@CLB	(F_LARGP)	;V4.03
	ld	wa,F_LPRN
	clr	(F_LPRN>>4).a
		ld	(STEP_CT),0
		j	timer_y_rush		;---> Motor stop Rush
		;--------------------------------------------------------------
timer_y_p02:
	ld	wa,F_PRREQ
	test	(F_PRREQ>>4).a		;bit -reverse-> jump status
	j	f,timer_y_p05		;if jump status is 0 -> branch
	ld	wa,F_REVCAN
	test	(F_REVCAN>>4).a		;bit -reverse-> jump status
	j	f,timer_y_p03		;if jump status is 0 -> branch
	ld	wa,F_EXFED
	set	(F_EXFED>>4).a
	ld	wa,F_RVREQ
	set	(F_RVREQ>>4).a
timer_y_p03:
		inc	(STEP_CT)
		j	timer_y_p50
		;--------------------------------------------------------------
timer_y_p05:				;1 line completed without feeding 1 line.
		ld	(STEP_CT),0	
;V4.07		@CLB	(F_LARGP)	;V4.06
	ld	wa,F_LPRN
	clr	(F_LPRN>>4).a
		j	timer_y_p20
		;--------------------------------------------------------------
timer_y_p08:
	ld	wa,F_STBON
	test	(F_STBON>>4).a		;bit -reverse-> jump status
	j	t,timer_y_p10		;if jump status is 1 -> branch
	ld	wa,F_STBDLY
	set	(F_STBDLY>>4).a
		j	timery_add		;---> Add to step_time
timer_y_p10:
		inc	(STEP_CT)
;V4.05		ld	a,(STEP_CT)
;V4.05		cmp	a,7
		cmp	(STEP_CT),7	;V4.05
		j	lt,timer_y_p20		;from start step to step6  yes-> no print
	ld	wa,F_LPRN
	test	(F_LPRN>>4).a		;bit -reverse-> jump status
	j	f,timer_y_p10z		;if jump status is 0 -> branch
	ld	wa,F_LARGP
	test	(F_LARGP>>4).a		;bit -reverse-> jump status
	j	f,timer_y_p10x		;if jump status is 0 -> branch
timer_y_p10z:
;V4.05		cmp	a,7+40			;
		cmp	(STEP_CT),7+40	;V4.05
		j	lt,timer_y_p40	;V4.07
		j	ne,timer_y_p50	;v4.07
	ld	wa,F_PRREQ
	clr	(F_PRREQ>>4).a
	ld	wa,F_LPRN
	set	(F_LPRN>>4).a
		jp	timer_y_p50	;V4.07
;V4.07		jp	timer_y_p10y		;V4.03
timer_y_p10x:
;V4.05		cmp	a,7+40+12		;V4.03
		cmp	(STEP_CT),7+40+12	;V4.05
timer_y_p10y:					;V4.03
		j	lt,timer_y_p40		;step7 to step46?  yes-> print
		j	ne,timer_y_p50		;last step?  no->
	ld	wa,F_PRREQ
	clr	(F_PRREQ>>4).a
	ld	wa,F_LPRN
	clr	(F_LPRN>>4).a
;V4.07		@CLB	(F_LARGP)	;V4.06

;V4.06		j	timer_y_p50		;

timer_y_p20:
		j	timer_y_p50

;print out................
timer_y_p40:
		call	strobe_cont
timer_y_p50:
		call	phase_out		;MT STEP output
		call	next_step_set		;

timer_y_exit:
	pop	iy
	pop	ix
	pop	hl
	pop	de
	pop	bc
	pop	wa
		reti
;
timer_y_rush:
	ld	wa,F_RUSH
	set	(F_RUSH>>4).a
	ldw	(TC2DRL),STP_RUSH			;set TC2DR
	ld	(TC2CR),0y00001110		;TC2CK(011)=fc/2^3 TC2S(0):stop TC2M(0):timer mode
	clr	(ILH).IL13		;clear TC6 request (ILH:bit4)
	set	(EIRH).EF13			;set TC6 enable (EIRH:bit4)
	ld	(TC2CR),0y00101110		;TC2CK(011)=fc/2^3 0.5us TC2S(1):start TC2M(0):timer mode
		j	timer_y_exit
;V3.13;
;-------------------------------------------------------------------
phase_tbl:
;		    IN2 IN1 ENA1&2   
;		     |	  \  ||  
;		      \	__ \|||  
;		          \ |||      
;		           ||||
;			   PPPP
;			   4444
;			   6543
		db	0y00011000	;step1
		db	0y00111000	;step2
		db	0y01111000	;step3
		db	0y01011000	;step4
;
phase_out:
;V3.00		@BBS	(SW_LTP,ltp_phase_out)	;LTP8235 printer?  yes->
		ld	a,(PHASE_CT)
		and	a,0y00000011
		ld	c,a
		ld	hl,phase_tbl
	ld	wa,SW_LTP
	test	(SW_LTP>>4).a		;bit -reverse-> jump status
	j	t,phase_out_1		;if jump status is 1 -> branch
		ld	hl,ltp_phase_tbl
phase_out_1:
		ld	a,(P4DR)
		and	a,0y00000100			;AIN1,AIN0 must set '0' for AD convert
		or	a,(hl+c)
		ld	(P4DR),a
	ld	wa,F_RVSE
	test	(F_RVSE>>4).a		;bit -reverse-> jump status
	j	f,phase_out_9		;if jump status is 0 -> branch
		inc	(PHASE_CT)
		ret
phase_out_9:
		dec	(PHASE_CT)
		ret

;-------------------------------------------------------------------
ltp_phase_tbl:
;		    IN2 IN1 ENA2&1   
;		     |	  \  ||  
;		      \	__ \ ||  
;		          \ |||      
;		           ||||
;			   PPPP
;			   4444
;			   6543
		db	0y01011000	;step4
		db	0y01111000	;step3
		db	0y00111000	;step2
		db	0y00011000	;step1

;V3.00ltp_phase_out:
;V3.00		ld	a,(PHASE_CT)
;V3.00		and	a,0y00000011
;V3.00		ld	c,a
;V3.00		ld	hl,ltp_phase_tbl
;V3.00		ld	a,(P4DR)
;V3.00		and	a,0y00000100			;AIN1,AIN0 must set '0' for AD convert
;V3.00		or	a,(hl+c)
;V3.00		ld	(P4DR),a
;V3.00		@BBS	(F_RVSE,ltp_phase_out_9)
;V3.00		inc	(PHASE_CT)
;V3.00		ret
;V3.00ltp_phase_out_9:
;V3.00		dec	(PHASE_CT)
;V3.00		ret

;
next_step_set:
	ld	wa,SW_LTP
	test	(SW_LTP>>4).a		;bit -reverse-> jump status
	j	f,ltp_next_step		;if jump status is 0 -> branch
		ld	a,(STEP_CT)
		cmp	a,2		;Step_1 ?
		j	ge,next_stp2	;no
		cmp	a,1
		j	eq,next_stp6	;
		ld	(STEP_CT),1
		j	next_stp5	;
next_stp2:
	ld	wa,F_STBDLY
	test	(F_STBDLY>>4).a		;bit -reverse-> jump status
	j	t,next_stp5		;if jump status is 1 -> branch
		ld	wa,(STB_BAK)
		cmp	wa,STP_SLOW_CMP		;previouse strobe length is shorter than slow step?
		j	lt,next_stp5
next_stp6:
	ldw	(TC2DRL),STP_SLOW			;set TC2DR
		j	next_stp8
next_stp5:
	ldw	(TC2DRL),STP_NORM			;set TC2DR
next_stp8:
	ld	(TC2CR),0y00001110		;TC2CK(011)=fc/2^3 TC2S(0):stop TC2M(0):timer mode
	clr	(ILH).IL13		;clear TC6 request (ILH:bit4)
	set	(EIRH).EF13			;set TC6 enable (EIRH:bit4)
	ld	(TC2CR),0y00101110		;TC2CK(011)=fc/2^3 0.5us TC2S(1):start TC2M(0):timer mode
	ld	wa,F_STBDLY
	clr	(F_STBDLY>>4).a
		ret

ltp_next_step:
	ld	wa,F_ACC
	test	(F_ACC>>4).a		;bit -reverse-> jump status
	j	t,ltp_next_stp5		;if jump status is 1 -> branch
		ld	a,(STEP_CT)
		cmp	a,4
		j	gt,ltp_next_stp5
		j	ne,ltp_next_stp2
	ld	wa,F_ACC
	clr	(F_ACC>>4).a
		ld	a,(STEP_CT)
ltp_next_stp2:
		shlc	a
		ld	c,a
		ld	hl,ltp_acc_tbl
		ld	wa,(hl+c)
		ld	(TC2DRL),wa		;accelaration step set to timer2
		j	ltp_next_stp8
ltp_next_stp5:
	ldw	(TC2DRL),STP_NORM_LTP			;set TC2DR
		ld	wa,STP_NORM_LTP
ltp_next_stp8:
		add	wa,STP_NORM_ADJ
		shlca	wa			;x2
		ld	(STEP_BAK),wa		;MT step back up for calculate 'C' parameater of STB pulse (LTP8235)
	ld	(TC2CR),0y00001110		;TC2CK(011)=fc/2^3 TC2S(0):stop TC2M(0):timer mode
	clr	(ILH).IL13		;clear TC6 request (ILH:bit4)
	set	(EIRH).EF13			;set TC6 enable (EIRH:bit4)
	ld	(TC2CR),0y00101110		;TC2CK(011)=fc/2^3 0.5us TC2S(1):start TC2M(0):timer mode
	ld	wa,F_STBDLY
	clr	(F_STBDLY>>4).a
		ret


strobe_cont:
	and	(P4DR),0y11111100			;AIN1,AIN0 must set '0' for AD convert
	ld	(ADCCR1),0y00100001		;AD conv. stop  s/w start  AIN enable  select AIN1(P41)
	ld	(ADCCR2),0y00011000		;Rudder connect when AD convert only, ACK=312/fc (19.5us convert time 16MHz)
	set	(ADCCR1).7			;AD convert start
		ld	cf,(STEP_CT).0		;even step?
		j	cc,stbc_51		;yes -> 
	clr	(P0DR).4
	nop
	set	(P0DR).4
	ld	wa,F_BHLD

⌨️ 快捷键说明

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