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

📄 printer.mac

📁 calculator code ,use toshibaor nec LSI
💻 MAC
📖 第 1 页 / 共 5 页
字号:
start_up:
		@VPR_ON
		@PHASE_ON
		@SEB	(P_MOVE)		;under printer moving
		di		
		@T2_STOP
		ei		
		@BBS	(SW_LTP,start_up1)	;LTP8235 printer?  yes->
		@T2_SET (STP_RUSH)		;set step MT pulse length for rush step
		j	start_up2
start_up1:
		@T2_SET (STP_WKUP_LTP)		;set step MT pulse length for rush step
		@SEB	(F_ACC)			;start accelaration step
start_up2:
		di			
		@T2_START			;timer2 start with 0.5us clock
		ei			
;		call	dbr_disp_clear		;DBR clear(real display data)
;		call	bl_off
		call	vft_disable
		ret
;V4.14============================================================
print_int_check:
		@BBC	(F_INIREQ,print_need_int)	;V4.14
		@CLB	(F_INIREQ)			;V4.14
		call	prn_init			;V4.14
print_need_int:						;V4.14
		ret					;V4.14
;---------------------------------------------------------------------------------
;	      Space Print  /  1-Line Print
print:
		call	print_int_check		;V4.14
;V4.14		@BBC	(F_INIREQ,print_need_int)	;V4.08
;V4.14		@CLB	(F_INIREQ)			;V4.10
;V4.14		call	prn_init			;V4.08
;V4.14print_need_int:						;V4.08
		@CLB	(F_REDBAK)

		@BBC	(P_RED,prnl_top0)
		@SEB	(F_REDBAK)
		@CLB	(P_RED)			;
prnl_top0:
		@BBS	(F_FEED,prnl_top0)
		@BBS	(SW_LTP,prnl_top1)	;LTP8235 printer?  yes->

		di
		@BBC	(F_EXFED,prnl_top1)
		ei
prnl_top01:
		@BBS	(F_EXFED,prnl_top01)
prnl_top02:
		@BBC	(F_RUSH,prnl_top02)
		@SEB	(F_PRINT)
		@SEB	(F_PRREQ)
		j	prnl_top10
prnl_top1:
		di
		@SEB	(F_PRREQ)
		@BBS	(F_PRINT,prnl_x1)	;---> printing
		ld	(STEP_CT),0		;MT step count clear (0~52)
		@SEB	(F_PRINT)
		@BBC	(F_RUSH,prnl_x0)	;under rush step?(already motor stop)  no-->
prnl_top10:
		@CLB	(F_RUSH)		;cancel rush step
		di				;
		@T2_STOP
		@T2_SET (STP_NORM)		;start print step within 1667us
		@T2_START
		ei				;
		j	prnl_x1

prnl_x0:
		ei
		call	start_up		;MT driver enable, motor start, dbr clear BL off
prnl_x1:
		di				;V4.07
		@CLB	(F_LARGP)		;V4.07
		@BBC	(F_ENLARG,prnl_x1x)	;V4.07
		@SEB	(F_LARGP)		;V4.07
		@CLB	(F_ENLARG)		;V4.07
prnl_x1x:					;V4.07
		ei
		@AD_TEMP			;set AD converter(AIN6) and start
		@BBS	(SW_LTP,prnl_x2)	;LTP8235 printer?  yes->
		@BBC	(F_RVREQ,prnl_x2)
		@CLB	(F_RVREQ)
		@SEB	(F_RVSE)		;reverse feed flag
		dec	(PHASE_CT)
prnl_x2:		
		ld	(LINE_PTR),0		;the line location of font(0~19)
		ld	(LINE_PTR_BK),0		;V4.03
		@GET_AD				;AD value -> reg.a
		cmp	a,224
		j	lt,prnl_01
		ld	a,223
prnl_01:
		sub	a,77
		j	cc,prnl_02
		ld	a,0
prnl_02:
		ld	w,0		;V4.05
		shrc	a
		@IS_LTP_OFF(prnl_02x)	;V4.16
		ld	c,a
		ld	hl,temp_table
		ld	a,(hl+c)
		ld	(HD_TEMP),a		;keep head temparature
		jp	prnl_02y		;V4.16
prnl_02x:
		shlc	a			;V4.04
		add	wa,lg_temp_table	;V4.05
		ld	de,wa			;V4.05
		ld	wa,(de)			;V4.05
		ld	(HD_TEMP),wa
prnl_02y:
		@CLB	(F_BHLD)		;for make sure
		;--------------------------------------------------------------
prnl_00:
		call	prnbuf_to_dot		;PRN_BUF(1line data)--> DOT_LINE
prnl_11:
		@BBS	(F_BHLD,prnl_11)	;
		@SEB	(F_BHLD)		;
		call	font_tx			; 1 dotline(288dots)---> shift registor of printer
		inc	(LINE_PTR_BK)		;V4.03
		@BBC	(F_LARGP,prn1_11_y)	;V4.03
		cmp	(LINE_PTR_BK),3		;V4.03
		j	eq,prn1_11_x		;V4.03
		cmp	(LINE_PTR_BK),7		;V4.03
		j	eq,prn1_11_x		;V4.03
		cmp	(LINE_PTR_BK),11	;V4.03
		j	eq,prn1_11_x		;V4.03
		cmp	(LINE_PTR_BK),15	;V4.03
		j	eq,prn1_11_x		;V4.03
		cmp	(LINE_PTR_BK),19	;V4.03
		j	eq,prn1_11_x		;V4.03
		cmp	(LINE_PTR_BK),23	;V4.03
		j	eq,prn1_11_x		;V4.03
prn1_11_y:					;V4.03
		inc	(LINE_PTR)		;
prn1_11_x:					;V4.03
		cmp	(LINE_PTR),20		; last line?
		j	lt,prnl_00		;no
		;--------------------------------------------------------------
prnl_90:
		@BBS	(F_PRREQ,prnl_90)	;still printing? yes-> loop
		ret

;
;1line dot(288dots) transmit.....................................................
font_tx:
		
		@INIT_SIO
		ld	(DOT_CT),0		;total dot q'ty of 1line
		ld	hl,DOT_LINE		;
		ld	c,0
		ld	e,(hl+c)		;5
		ld	(SIOBUF),e		;5
		@START_SIO			;5  start transmit 1byte
		j	font_tx_12
font_tx_1:
		ld	cf,(SIOSR).6		;check shift end flag
		j	cs,font_tx_1
;		or 	(P1DR),0y11000000	;P17(CK: Hi-z), P16(EEIN: Hi-z)
		ld	e,(hl+c)		;5
		ld	(SIOBUF),e		;5
font_tx_12:
		ld	d,0
		add	de,dotcnt_tbl		;4
		ld	a,(de)			;3
		add	a,(DOT_CT)		;5
		j	cs,font_tx_2		;2
		ld	(DOT_CT),a		;5
font_tx_2:
		inc	c			;1
		cmp	c,36			;3
		j	lt,font_tx_1		;4
;					        ----
;						 42 cycle = 21us  *transration speed = 16us/1byte
		@DIS_SIO			;disable sio
		ret
sio_int:
		reti
;----------------------------------------------------------------------
;		   PRN_BUF(1line data)-> DOT_LINE
;
prnbuf_to_dot:
		ld	c,0			;reg.c <-- location of PRN_BUF(0~23)
		ld	ix,DOT_LINE		;reg.ix <-- address of DOT_LINE (+0 to +35)
prn_dot_00:
		ld	hl,PRN_BUF		;
		ld	a,(hl+c)		;get 1digit character	        reg.a     reg.w
		call	font_dot		;get font data -> reg.wa      dddd dddd dddd 0000
		ld	cf,c.0			;
		j	cs,prn_dot_20		;odd digit?  yes->
		ld	(ix),wa			;DOT_LINE <-- font data  (+0 <-- reg.a  +1 <-- reg.w)
		inc	ix
		j	prn_dot_30
prn_dot_20:
		swap	a
		ld	b,a
		and	b,0xf0
		or	b,(ix)
		ld	(ix),b
		inc	ix
		swap	w
		and	a,0x0f
		or	a,w
		ld	(ix),a
		inc	ix
		or	w,(ix)
prn_dot_30:
		inc	c
		cmp	c,PRN_MAX
		j	lt,prn_dot_00
		ret
;
;------------------------------------------------------------------------
; Get font data
; In:  Reg.a <- ascii code     reg.a    reg.w
; Out: Reg.wa <- Font data  dddd dddd dddd 0000
font_dot:
;V4.02		sub	a,0x20
;V4.02		j	cc,font_dot_1
;V4.02		ld	a,0
;V4.02font_dot_1:
		ld	b,a			;reg.b <- save character code
;V4.02		cmp	a,0x10
;V4.02		j	lt,font_dot_3
;V4.02		cmp	a,0x1a
		cmp	a,10		;V4.02 to check the digitals
		j	ge,font_dot_3	;not idgit-->
;numeric (10h to 19h)
;3.00		@BBS	(F_SMALLNUM,font_dot_11)	;
;V4.02		@BBS	(F_REDBAK,font_dot_12)
		@BBC	(F_REDBAK,font_dot_3)	;V4.02
		ld	a,b
;V4.02		j	font_dot_3
;3.00font_dot_11:
;3.00		ld	de,font_snum
;3.00		j	font_dot_13
font_dot_12:
		ld	de,font_bnum
font_dot_13:
;V4.02		sub	b,0x10
;V4.02		ld	a,b
		j	font_dot_4
font_dot_3:
		ld	a,b
		ld	de,font_data
font_dot_4:
		ld	w,20*2			;20 x 2 bytes / 1font data
		mul	w,a
		add	de,wa
		ld	a,(LINE_PTR)
		shlc	a
		ld	w,0
		add	de,wa
		ld	wa,(de)			
		ret

;==============================================================================
;	Timer6Interrupt (STEPPING MT / phase chopping control) 
;==============================================================================
;Stepping MT drive........................................................
tm2_int:
		@PUSH_REG
		@T2_STOP
		@BBC	(F_STBDLY,timer_y_000)	;---> MT drive
		@BBC	(F_CHPOFF,timery_0)
		@CLB	(F_CHPOFF)
		@PHASE_ON			;phase ON(MT driver enable)
		@T2_SET (STP_CPON)		;set 300us for chopping on time
		j	tm2_exit
timery_0:
		@SEB	(F_CHPOFF)
		@PHASE_OFF			;phase OFF(MT driver disable)
		@T2_SET (STP_CPOF)		;set 50us for chopping off time
		j	tm2_exit
;chopping process for long strobe pulse.....
timery_add:					;Step Time + ADD(300us) + ON(300us)
;		@SEB	(F_CHPOFF)		;Next phase ON(= 300us)
;		@T2_SET (STP_CPON)		;set 300us
		@SEB	(F_CHPOFF)
		@PHASE_OFF			;phase OFF(MT driver disable)
		@T2_SET (STP_CPOF)		;set 50us for chopping off time

tm2_exit:
		@T2_START			;start with 0.5us clock
		@POP_REG
		reti
;
;--------------------------------------------------------------------------------------
timer_y_000:
		@BBS	(F_PRINT,timer_y_prn)	;---> printing
		@BBS	(F_FEED,timer_y_feed)	;---> key feed
		@BBS	(F_INIT,timer_y_init)	;---> init feed

;finish rush step  --> complete printing
		@VPR_OFF			;
		@PHASE_OFF
		@DIS_SIO			;
		@CLB	(P_MOVE)		;under printer moving
		@CLB	(F_RUSH)		;cancel rush step
		@BBS	(F_REVCAN,timer_y_exit)		;under calculation?(especially need long time)  yes-> do no update display
;		call	tempdbr_to_dbr		;copy  temporally edit area -> real DBR
;		call	bl_on
		call	vft_enable
		j	timer_y_exit
;
timer_y_init:
		@BBS	(SW_LTP,ltp_timer_y_init)	;LTP8235 printer?  yes->
		inc	(STEP_CT)
		cmp	(STEP_CT),16
		j	lt,timer_y_i2
		@CLB	(F_INIT)		;== complete init ==
		j	timer_y_rush		;---> Motor stop Rush
timer_y_i2:
		call	phase_out
		@T2_SET (STP_INIT)		;set step MT pulse length for intialize
		@T2_START			;timer2 start with 0.5us clock
		j	timer_y_exit

⌨️ 快捷键说明

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