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

📄 bitmap.s

📁 linux 的引导程序源码The Microsoft&reg Windows&reg Software Development Kit (SDK) provides the documentation
💻 S
字号:
; bitmap.S  is; Copyright 2001 John Coffman.; All rights reserved.; ; Licensed under the terms contained in the file 'COPYING' in the ; source directory.;;#define ncol KEYTABLE+256+mt_ncol; menu_setup:;   main setup menu for LILO boot selection process;;   replaces code to load & display the message in second.S;;   exit with DS=ES=CS;menu_setup:	pusha	BEG_FS	SEG_FS			! message disabled ?	cmp	word ptr par1_msg_len+SSDIFF,#0		;MSG_OFF+SSDIFF,#0	END_FS	je	ms_do_find	! yes -> skip this	BEG_FS	SEG_FS		! load the message file	mov	cx,par1_msg+SSDIFF			;MSG_OFF+SSDIFF+2	SEG_FS	mov	dx,par1_msg+2+SSDIFF        SEG_FS	mov	al,par1_msg+4+SSDIFF	END_FS	mov	bx,#MAP	call	sread	call	loadfile	push	#SYSSEG	pop	es	xor	bx,bx	push	es		; save for later	push	bx	call	_display4	; ES:BX points to the Message or BITMAP	pop	bx	BEG_FS	SEG_FS	xchg	bx,par1_msg_len+SSDIFF		;MSG_OFF+SSDIFF	END_FS	cmp	ax,#1	jb	good_bitmap		; AX==0, bitmap was displayed	pop	ds		ja	ms_do_find		; AX==2 or 3; "BM" sig found, but					; wrong bitmap or no VGA adapter	; AX==1, no "BM" signature, assume "message"	mov	byte ptr (bx),#0	call	crlf	xor	bx,bx		! display the message	call	say	jmp	ms_do_find;--------------------------------------------good_bitmap:	pop	es	inc	word [suppress]	mov	word [abs_cx],#0x101	; mark screen in use	ms_do_find:	push	cs	pop	ds		; make sure DS is good	xor	si,si		; number of names	xor	di,di		; max. name length	mov	cx,#IMAGES	; get max number to search	mov	bx,#DESCR0	; get address to start atfindl1:	call	strlen		; get length in ax	or	ax,ax	jz	findl3#ifdef LCF_VIRTUAL	test	word ptr (bx+id_flags),#FLAG_VMDEFAULT	jz	findl1c	call	vmtest	jnc	findl1c	mov	[vimage],sifindl1c:#endif	cmp	ax,di	jb	findl2	xchg	ax,difindl2:	add	bx,#id_size	inc	si	loop	findl1findl3:	mov	[nimage],si	mov	[limage],di;;;	mov	ax,si			; number of images	mov	bx,[ncol]		; 	add	ax,bx	dec	ax	div	bl;MINROW = 4	cmp	al,[KEYTABLE+256+mt_mincol]	ja	row1	mov	al,[KEYTABLE+256+mt_mincol]row1:	mov	bx,[KEYTABLE+256+mt_maxcol]	;	cmp	al,bl	jbe	row2	xchg	ax,bxrow2:	mov	[nrow],al;;;	xor	ax,ax			;display the list of names	mov	cx,sifindl4:	call	lowlite	inc	ax	loop	findl4	mov	ax,[dimage]		; bug fix#ifdef LCF_VIRTUAL	test	byte ptr [cmdline],#0xFF	jnz	vdone3	mov	ax,[vimage]vdone3:#endif	call	hilite	push	cs	pop	es			; make sure ES is good on exit	popa	ret; end of menu_setup subroutine#if DEBUG_NEWno_bmp:	.ascii	" = AL; NOT a bitmap file\n"	.byte	0#endif; find_image;	if there is something on the command line;	return the image number it selects;;	enter with:;		nothing;	exit with:;		If nothing selected:;		    Carry Clear;		    AX==0;		If an image is selected:;		    Carry SET;		    AX==#image;		    BX==pointer to descriptor;		    ;;	side effect:;		The selected image is hi-lited if the menu is displayed;find_image:	push	cx	push	si	push	di		mov	cx,#IMAGES	! test all names	mov	si,#DESCR0	push	sifi_nextn:	mov	di,#cmdlinefi_nextc:	mov	al,(si)		! get next character in descr				! get the character#ifdef LCF_IGNORECASE	call	upcase#endif	mov	ah,al	mov	al,(di)		! get next char in cmdline#ifdef LCF_IGNORECASE	call	upcase#endif	or	ah,ah		! NUL in descriptor name	jz	fi_dscend	cmp	al,ah		! character equal ?	jne	fi_skipn		! no -> try next one	inc	si		! test next character	inc	di	jmp	fi_nextcfi_dscend:		cmp	al,#32		! space or NUL -> equal	je	fi_found	or	al,al	jz	fi_foundfi_skipn:	pop	si	add	si,#id_size	! test next name	push	si	loop	fi_nextn	pop	si	xor	ax,ax		; clears the carryfi_exit:	pop	di	pop	si	pop	cx	ret	fi_found:	pop	bx		! BX is matched descriptor	mov	ax,bx	sub	ax,#DESCR0	mov	cl,#id_size	div	cl	cbw	mov	di,[dimage]	cmp	ax,di	je	fi_nochange	mov	[dimage],ax	cmp	byte [abs_cx+1],#0	! see if menu is displayed	je	fi_nochange	xchg	ax,di	call	lowlite	xchg	ax,di	call	hilitefi_nochange:	stc	jmp	fi_exit; menu_delline:;	delete the current command line;  				common code from original second.S;;	enter with:;		BX = command line pointer;;	exit with:;		BX = updated command line pointer;;menu_delline:	cmp	bx,#cmdline	! done ?	je	mdel9		! yes -> done	push	bx		! display BS,SPC,BS	mov	bx,#bs	call	say	pop	bx	dec	bx		! move the pointer	jmp	menu_delline		! next onemdel9:	ret; menu_setcmd:;	set currently selected image to be the command line;;	enter with:;		AX = image# to select;		BX = cmdline pointer;;	exit with:;		BX = updated;;menu_setcmd:	push	si	push	ax	call	menu_delline	; delete the current line	pop	si		; get image# back	imul	si,#id_size	add	si,#DESCR0mset1:	lodsb	or	al,al	jz	mset6	mov	(bx),al	inc	bx	push	bx	call	display	pop	bx	jmp	mset1	mset6:	pop	si		ret; arrow;;   Code that handles the arrow keys:  left, up, down, right;;arrow:	cbw			; signed delta vector in AL	mov	dx,[dimage]	;	add	dx,ax		; new position	or	dx,dx	jns	arr1arr0:	xor	dx,dx		; set to zero if neg.arr1:	mov	ax,[nimage]	cmp	dx,ax		; compare to max.	jb	arr2	mov	dx,ax	dec	dxarr2:			; we know the one to hi-lite is in range	mov	ax,[dimage]	cmp	ax,dx	je	arr6	call	lowlite		; un-hilite the old	xchg	ax,dx	call	hilite	call	menu_setcmd	; set new command linearr6:	jmp	arr_vector	null:	mov	al,#1	cmp	ah,#0x50		; down arrow	je	arrow	neg	al	cmp	ah,#0x48		; up arrow	je	arrow	mov	dx,[nimage]	cmp	ah,#0x4f		; end	je	arr1	cmp	ah,#0x47		; home	je	arr0	mov	al,[nrow]	xchg	ax,dx	mov	ax,[dimage]	div	dl				xchg	ax,dx			; DL = cur col.	cmp	ah,#0x4d		; right arrow	jne	arr8	inc	dx			; similar to  dec al	cmp	dl,[ncol]		; cmp (CUR COL + 1) : (NCOL)	jb	arrow	jmp	arr9	arr8:	cmp	ah,#0x49		; pg up	jne	arr84	neg	dh			; remainder [0..(nrow-1)]	mov	al,dharrow1:	jmp	arrowarr84:	cmp	ah,#0x51		; pg dn	jne	arr88	not	dh	add	al,dh	jmp	arrowarr88:	neg	al	cmp	ah,#0x4b		; left arrow	jne	arr9	or	dl,dl	jnz	arrow1arr9:	cmp	ah,#0x53		; DEL	jne	arr_vector	br	delch			; treat as 0177 (rubout)arr_vector:	br	input		; ignore the rest; menu_exit:;	erase the menu box to black;menu_exit:	push	es	pusha#if DEBUG_NEW	call	me1	.ascii	"menu_exit entered"	.byte	10,0me1:	pop	bx	call	say;;	call	pause#endif	xor	ax,ax	cmp	word [abs_cx],ax	mov	word [suppress],ax	mov	word [abs_cx],ax	je	mn_exit_ret	call	_done4#if DEBUG_NEW	call	me2	.ascii	"called done4"	.byte	10,0me2:	pop	bx	call	say;;	call	pause#endifmn_exit_ret:#if DEBUG_NEW	call	me3	.ascii	"exit from menu_exit"	.byte	10,0me3:	pop	bx	call	say;;	call	pause#endif	popa	pop	es	ret#if 0; menu_form_feed:;	simulate a FF on the console;menu_form_feed:	ret#endif; timer_display:;	check the timer 'cntdown' and display changes;timer_display:	push	es	pusha	test	byte [KEYTABLE+256+mt_t_row+1],#0xff	; see if not initialized	js	timer99	mov	dx,#0x2d2d	; get "--" means disabled	mov	[tim_min],dx	mov	[tim_sec],dx	mov	ax,[cntdown]	; get timer countdown location	cmp	ax,[tim_tick]	je	timer99	mov	[tim_tick],ax	; save last tick count		inc	ax	jz	timer8	mul	c55		; get time remaining in ms.	div	c1000		; convert to seconds	cmp	ax,[tim_old]		je	timer99	mov	[tim_old],ax	; save seconds remaining	xor	dx,dx	div	c60		; minutes in AX, seconds in DX		aam	add	ax,#0x3030	xchg	ah,al	mov	[tim_min],ax	; put characters in buffer	xchg	ax,dx	aam	add	ax,#0x3030	xchg	ah,al	mov	[tim_sec],ax	; put characters in buffertimer8:	push	ds		;sch-hi	push	#KEYTABLE+256+mt_t_fg	push	#5		; len	push	ds		; cp -hi	push	#tim_min	push	word [KEYTABLE+256+mt_t_row]	push	word [KEYTABLE+256+mt_t_col]	call	_text	add	sp,#14timer99:	popa	pop	es	rettim_min: db	0,0	.ascii	":"tim_sec: db	0,0tim_old:  dw	0		; last # secondstim_tick: dw	0		; last timer tick value examinedc55:	.word	2197		;was 55, now 54.925*40c1000:	.word	40000		;was 1000, now 40*1000c60:	.word	60; hilite/lowlite;	enter with:;		AX = number [0..(nimage-1)] of entry to hilite;hilite:	push	es	pusha	mov	[dimage],ax		;remember one hilited	push	cs	push	#KEYTABLE+256+mt_h_fg	jmp	lowlite1lowlite:	push	es  	pusha	push	cs			; sch hi	push	#KEYTABLE+256+mt_fg	; sch lowlowlite1:	cmp	BYTE [abs_cx+1],#0	je	lowlite9	mov	bx,ax		;save argument in BX	mov	al,#0x20	; SP	mov	cx,[limage]	inc	cx	inc	cx	mov	di,#im_name	push	cx			; len	push	ds			; cp hi	push	di			; cp low	push	ds	pop	es	rep	  stosb	imul	si,bx,#id_size	add	si,#DESCR0	mov	di,#im_name+1lowlite2:	lodsb	or	al,al	jz	lowlite3	stosb	jmp	lowlite2lowlite3:	mov	cx,[KEYTABLE+256+mt_col]	mov	ax,[KEYTABLE+256+mt_row]	mov	si,[nrow]lowlite4:	cmp	bx,si	jb	lowlite5	add	cx,[KEYTABLE+256+mt_xpitch]	sub	bx,si	jmp	lowlite4lowlite5:#ifdef PIXADDRESS	shl	bx,#4		;use pixel addressing#endif	add	ax,bx	push	ax	push	cx	call	_text	add	sp,#10lowlite9:	add	sp,#4	popa	pop	es	retim_name:  .blkb	MAX_IMAGE_NAME+3	.evendimage:	dw	0	; default image#ifdef LCF_VIRTUALvimage:	dw	0	; vmdefault image#endifnimage:	dw	0	; number of imageslimage:	dw	0	; longest length of image namenrow:	dw	0	; number of rows of selections;nrow	equ	KEYTABLE+256+mt_maxcol;ncol:	dw	0	; number of columns (default=2);ncol	equ	KEYTABLE+256+mt_ncolabs_cx:	dw	0	; upper left of scrolling area; end of bitmap.S

⌨️ 快捷键说明

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