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

📄 display.s

📁 坦尼保姆
💻 S
📖 第 1 页 / 共 2 页
字号:
! CNTRL-v is an terminal escape character for some control characters.ft_ld:	PUSH	AX			! save registers	PUSH	BX	PUSH	CX	PUSH	DX	PUSH	SI	PUSH	DI	PUSH	BP	MOV	BP, SP	PUSH	fontl			! Push font file name	MOV	BX, tm_hd	LEA	AX, TM_FONTPATH(BX)	! Push font directory	PUSH	AX	PUSH	_ffn			! Set the string buffer	PUSH	buf	PUSH	_SPRINTF		! format string system call	SYS				! buf contains pathname of file	ADD	SP, 10	PUSH	O_RDONLY		! open font file	PUSH	buf			! PUSH path name pointer	PUSH	_OPEN	SYS	ADD	SP, 6	MOV	(fd), AX		! check for open error	CMP	(fd), 0	JGE	0f	PUSH	buf	CALL	op_err	ADD	SP, 20:	PUSH	FT_HD_SZ		! read font header	PUSH	ft_hd	PUSH	(fd)	PUSH	_READ	SYS	ADD	SP, 8	CMP	AX, FT_HD_SZ		! check for read error	JE	1f	PUSH	err4	PUSH	_PRINTF	SYS	ADD	SP, 4	CALL	ex_err1:	MOV	BX, ft_hd		! check size of font cache	CMP	FT_SIZE(BX), FT_CH_SZ	JLE	2f	PUSH	err5	PUSH	_PRINTF	SYS	ADD	SP, 4	CALL	ex_err2:	PUSH	FT_SIZE(BX)		! read font data	PUSH	ft_ch	PUSH	(fd)	PUSH	_READ	SYS	ADD	SP, 8	CMP	AX, FT_SIZE(BX)		! check for read error	JE	3f	PUSH	err6	PUSH	_PRINTF	SYS	ADD	SP, 4	CALL	ex_err3:	PUSH	(fd)			! close font file	PUSH	_CLOSE	SYS	ADD	SP, 6	MOV	SP, BP	POP	BP	POP	DI	POP	SI	POP	DX	POP	CX	POP	BX	POP	AX	RET!! some small functions!op_err:					! Open error routine	PUSH	BP	MOV	BP, SP	PUSH	4(BP)	PUSH	err1	PUSH	_PRINTF	SYS	ADD	SP, 6	CALL	ex_err	MOV	SP, BP	POP	BP	RETex_err:				! exit in case of an error	PUSH	1	PUSH	_EXIT	SYSex_ok:				! exit in case of success	PUSH	0	PUSH	_EXIT	SYS! global initialized data.SECT	.DATAfontl:	.ASCIZ	"n"		! font name normal font (times roman)tm_cf:	.ASCIZ	"sys/term.cf"	      ! pathname terminal header	! for terminal with characters fonts up to 8x14 bits. The window size is	! 36x16 characters.	! alternative term9.cf : 9x16 bits, 32x14 characters	! alternative term7.cf : 7x13 bits, 40x17 characterserr1:	.ASCIZ	"Cannot open %s\n"err2:	.ASCIZ	"Error reading terminal configuration data\n"err3:	.ASCIZ	"Screen cache not big enough\n"err4:	.ASCIZ	"Error reading font header\n"err5:	.ASCIZ	"Font cache not big enough\n"err6:	.ASCIZ	"Error reading font data\n"err7:	.ASCIZ	"Error reading standard input\n"! some global and often used local variables.SECT	.BSS.ALIGN	2fd:	.SPACE	2			! file descriptor variabletmbytw:	.SPACE	2			! width of terminal in bytesbuf:	.SPACE	128			! general purpose string buffertm_ch:	.SPACE	TM_CH_SZ		! reserve space for termina bitmaptm_hd:	.SPACE	TM_HD_SZ		! reserve space for terminal recordft_hd:	.SPACE	FT_HD_SZ		! reserve space for font table headerft_ch:	.SPACE	FT_CH_SZ		! reserve space for font table_eod:	.SPACE	2			! dummy variable end of data.SECT .DATApstringa: .ASCII "%!PS-Adobe-2.0 EPSF-2.0\n%%Title: exercise.ps\n".ASCII "%%Creator: XV Version 3.10a  Rev: 12/29/94  -  by John Bradley\n".ASCII "%%BoundingBox: 32 182 581 611\n%%Pages: 1\n%%EndComments\n".ASCII "%%EndProlog\n%%Page: 1 1\n/origstate save def\n20 dict begin\n".ASCII "/grays 288 string def \n/npixls 0 def\n".ASCIZ "/rgbindx 0 def\n37 187 translate\n538.56000 418.89600 scale\n"pstringb: .ASCII "\n\n\nshowpage\n% stop using temporary dictionary\nend\n\n".ASCIZ "% restore original state\norigstate restore\n\n%%Trailer\n"pstringc: .ASCII "/pix %d string def\n%d %d 1\n[%d 0 0 -%d 0 %d]\n"pstringd: .ASCIZ "{currentfile pix readhexstring pop }\nimage\n"pstringe: .ASCIZ "%02x"pstringf: .ASCIZ "\n"pstringg: .ASCIZ "charmap`.eps"pstringh: .ASCIZ "Cannot open postscript file %s\n"pstringi: .ASCIZ "charmap`.pbm".ALIGN	2.SECT .TEXTposout:	INCB (pstringg+7)	PUSH 0644	PUSH pstringg	PUSH _CREAT	SYS	ADD  SP,6	CMP  AX,0	JL   9F	MOV  (fd),AX	PUSH pstringa	PUSH AX	CALL stringpr	ADD  SP,4	MOV  AX,TM_WID(BX)	MOVB CL,3	SAR  AX,CL	MOV  (tmbytw),AX	PUSH TM_HT(BX)	PUSH TM_HT(BX)	PUSH TM_WID(BX)	PUSH TM_HT(BX)	PUSH TM_WID(BX)	PUSH AX	PUSH pstringc	PUSH buf	PUSH _SPRINTF	SYS	ADD SP,18	PUSH buf	PUSH (fd)	CALL stringpr	ADD SP,4	MOV SI,tm_ch	MOV CX,TM_HT(BX)6:	PUSH CX	MOV CX,(tmbytw)	MOV DI,buf7:	LODSB	PUSH AX	PUSH pstringe	PUSH DI	PUSH _SPRINTF	SYS	ADD  SP,8	ADD  DI,2	LOOP 7b	MOV  (DI),'\n'	MOV  AX,(tmbytw)	SHL  AX,1	INC  AX	PUSH AX	PUSH buf	PUSH (fd)	PUSH _WRITE	SYS	ADD  SP,8	POP CX	LOOP 6b	PUSH pstringb	PUSH (fd)	CALL stringpr	PUSH _CLOSE	SYS	ADD  SP,6	RETgeterr:	PUSH err7	PUSH _PRINTF	SYS	CALL ex_errcrerror:9:	PUSH pstringg	PUSH pstringh	PUSH _PRINTF	SYS	CALL ex_errstringpr:	PUSH CX	PUSH DI	PUSH BP	MOV  BP,SP	MOV  AX,0	MOV  DI,10(BP)	MOV  SI,DI	MOV  CX,-1	REPNZ SCASB	NOT  CX	DEC  CX	PUSH CX	PUSH 10(BP)	PUSH 8(BP)	PUSH _WRITE	SYS	MOV  SP,BP	POP  BP	POP  DI	POP  CX	RET	_FAKEWIN	= 64			! extra routine to open window	_FWINOUT	= 65			! and to write onto window		_ENKLBIT	= 1		! small window display per bit		_DBBLBIT	= 2		! large window, square per bit						! The prevous subroutines create						! two x window bitmap files:						! lEEGbITmAP and tERMbITmAP! next we get a routine to initialise an output window. It is made with an! unorthodox type of extra library routine. Its parameters are width and height! of the terminal bit map.! Do not worry about this routine at all..SECT .DATAfaker:	.WORD 0.SECT .TEXTstartfak:	INC	(faker)	PUSH	_DBBLBIT		! Bit size two bits per bit in display	PUSH	TM_HT(BX)		! Stack height of bitmap in bits	PUSH	TM_WID(BX)		! Stack width of bitmap in bits	PUSH	_FAKEWIN		! stack library call number	SYS				! and ask for the routine	ADD	SP,8			! clean up stack.	RET! Hope that the window system is smart enough to open up the window now.tclout:	PUSH	AX			! save registers on stack	PUSH	BX	PUSH	BP	MOV	BP, SP	MOV	BX, tm_hd		! BX indicates start of terminal record	CMP	(faker),0	JG	8f	CALL	startfak8:	PUSH	tm_ch			! Start adress of bitmap	MOV	BX, tm_hd		! BX indicates start of terminal record	PUSH	TM_HT(BX)		! Stack height of bitmap in bits	PUSH	TM_WID(BX)		! Stack width of bitmap in bits	PUSH	_FWINOUT		! stack library call number	SYS				! and ask for the routine	ADD	SP, 8			! clean up stack.	MOV	SP, BP	POP	BP			! restore registers	POP	BX	POP	AX	RET! Hope that the window system is smart enough to write onto the window now.! end of file

⌨️ 快捷键说明

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