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

📄 findbl.asm

📁 用来将电脑连接到电视荧幕, 并以15Khz输出的源码, 请只用在支援15Khz的荧幕上, 以免伤害荧幕
💻 ASM
字号:
IDEAL
P386
SMART

MODEL COMPACT,C



GLOBAL C findblade:NEAR

GLOBAL C get_pm_table_offset:NEAR
GLOBAL C get_pm_table_segment:NEAR
GLOBAL C get_pm_table_length:NEAR
GLOBAL C own_pm_interface_supported:NEAR

DATASEG
device_bus_number	dd	0


CODESEG

PROC findblade NEAR
		mov 	eax,0b101h
		mov 	edi,0
		int 	01ah

		cmp 	edx,20494350h
		jne 	notfound

		mov 	eax,0b102h
		mov 	ecx,09880h
		mov 	edx,01023h
		mov 	esi,0
		int 	01ah
		or		ah,ah
		jz		found_blade

		mov 	eax,0b102h
		mov 	ecx,09910h
		mov 	edx,01023h
		mov 	esi,0
		int 	01ah
		or		ah,ah
		jz		found_blade


		jmp 	notfound

found_blade:
		mov 	[dword ptr device_bus_number], ebx
		mov 	eax, ecx
		ret
notfound:
		xor 	eax, eax
		ret
ENDP


PROC own_pm_interface_supported NEAR
		mov 	ax, 1
		ret
ENDP

PROC get_pm_table_offset NEAR
		mov 	ax, OFFSET PMTable
		ret
ENDP

PROC get_pm_table_segment NEAR
		mov 	ax, cs
		ret
ENDP

PROC get_pm_table_length NEAR
		mov 	ax, OFFSET PMTableEnd - PMTable
		ret
ENDP


PMTable:
	DW	PMSetWindow - PMTable
	DW	PMSetStartAddress - PMTable
	DW	PMSetPalleteRange - PMTable
	DW	0000h


PMSetWindow:
	DB 0FAh 							;	cli
	DB 050h 							;	push	eax
	DB 053h 							;	push	ebx
	DB 052h 							;	push	edx
	DB 08Bh, 0DAh						;	mov 	ebx, edx
	DB 080h, 0CBh, 0C0h 				;	or		bl, 0C0h
	DB 080h, 0F3h, 002h 				;	xor 	bl, 02h
	DB 066h, 0BAh, 0C4h, 003h			;	mov 	dx, 03C4h
	DB 0B0h, 00Bh						;	mov 	al, 0Bh
	DB 0EEh 							;	out 	dx, al
	DB 042h 							;	inc 	edx
	DB 0ECh 							;	in		al, dx	; new mode
	DB 04Ah 							;	dec 	edx
	DB 0B0h, 00Eh						;	mov 	al, 0Eh
	DB 0EEh 							;	out 	dx, al
	DB 042h 							;	inc 	edx
	DB 08Ah, 0C3h						;	mov 	al, bl
	DB 0EEh 							;	out 	dx, al
	DB 05Ah 							;	pop 	edx
	DB 05Bh 							;	pop 	ebx
	DB 058h 							;	pop 	eax
	DB 0FBh 							;	sti
	DB 0C3h 							;	ret



PMSetPalleteRange:
	DB 050h 							;	push	eax
	DB 051h 							;	push	ecx
	DB 052h 							;	push	edx
	DB 057h 							;	push	edi

	DB 066h, 085h, 0C9h 				;	test	cx, cx
	DB 074h, 01Eh						;	jz		NEAR _end_pl
	DB 08Ah, 0C2h						;	mov 	al, dl
	DB 066h, 0BAh, 0C8h, 003h			;	mov 	dx, 03C8h
	DB 0EEh 							;	out 	(dx), al
	DB 066h, 042h						;	inc 	dx
										;_loop_pl:
	DB 026h, 08Ah, 047h, 002h			;	mov 	al, [BYTE PTR es:edi + 2]
	DB 0EEh 							;	out 	(dx), al
	DB 026h, 08Ah, 047h, 001h			;	mov 	al, [BYTE PTR es:edi + 1]
	DB 0EEh 							;	out 	(dx), al
	DB 026h, 08Ah, 007h 				;	mov 	al, [BYTE PTR es:edi]
	DB 0EEh 							;	out 	(dx), al
	DB 083h, 0C7h, 004h 				;	add 	edi, 4
	DB 066h, 049h						;	dec 	cx
	DB 075h, 0EBh						;	jnz 	NEAR _loop_pl
										;_end_pl:

	DB 05Fh 							;	pop    edi
	DB 05Ah 							;	pop    edx
	DB 059h 							;	pop    ecx
	DB 058h 							;	pop    eax
	DB 0C3h 							;	ret



PMSetStartAddress:
	DB 0FAh 							;	cli
	DB 050h 							;	push	eax
	DB 051h 							;	push	ecx
	DB 052h 							;	push	edx

	DB 0C1h, 0E2h, 010h 				;	shl 	edx, 16
	DB 066h, 08Bh, 0D1h 				;	mov 	dx, cx
	DB 08Bh, 0CAh						;	mov 	ecx, edx
	DB 066h, 0BAh, 0CCh, 003h			;	mov 	dx, 03CCh
	DB 0ECh 							;	in		al, (dx)
	DB 0BAh, 0B4h, 003h, 0BAh, 003h 	;	mov 	edx, 03BA03B4h
	DB 024h, 001h						;	and 	al, 001h
	DB 074h, 005h						;	jz		NEAR _jmp_1
	DB 0BAh, 0D4h, 003h, 0DAh, 003h 	;	mov 	edx, 03DA03D4h
										;_jmp_1:
	DB 08Ah, 0E1h						;	mov 	ah, cl
	DB 0B0h, 00Dh						;	mov 	al, 00Dh
	DB 066h, 0EFh						;	out 	(dx), ax
	DB 08Ah, 0E5h						;	mov 	ah, ch
	DB 0B0h, 00Ch						;	mov 	al, 00Ch
	DB 066h, 0EFh						;	out 	(dx), ax

	DB 0C1h, 0E9h, 010h 				;	shr 	ecx, 16

	DB 0B0h, 01Eh						;	mov 	al, 01Eh			; CRTCModuleTest
	DB 0EEh 							;	out 	(dx), al
	DB 066h, 042h						;	inc 	dx
	DB 0ECh 							;	in		al, (dx)
	DB 066h, 04Ah						;	dec 	dx
	DB 024h, 0DFh						;	and 	al, 0DFh			; clear bit5
	DB 08Ah, 0E1h						;	mov 	ah, cl
	DB 080h, 0E4h, 001h 				;	and 	ah, 001h			; bit16 		  startaddr
	DB 0C0h, 0E4h, 005h 				;	shl 	ah, 5
	DB 00Ah, 0E0h						;	or		ah, al
	DB 0B0h, 01Eh						;	mov 	al, 01Eh
	DB 066h, 0EFh						;	out 	(dx), ax

	DB 0B0h, 027h						;	mov 	al, 027h			; CRTHiOrd
	DB 0EEh 							;	out 	(dx), al
	DB 066h, 042h						;	inc 	dx
	DB 0ECh 							;	in		al, (dx)
	DB 066h, 04Ah						;	dec 	dx
	DB 024h, 0F8h						;	and 	al, 0F8h			; clear bit2 1 0
	DB 08Ah, 0E1h						;	mov 	ah, cl
	DB 0D0h, 0ECh						;	shr 	ah, 1
	DB 080h, 0E4h, 007h 				;	and 	ah, 007h			; bit17 18 19	  startaddr
	DB 00Ah, 0E0h						;	or		ah, al
	DB 0B0h, 027h						;	mov 	al, 027h
	DB 066h, 0EFh						;	out 	(dx), ax

	DB 0FBh 							;	sti

	DB 0C1h, 0EAh, 010h 				;	shr 	edx, 16
	DB 080h, 0FBh, 000h 				;	cmp 	bl, 00h
	DB 074h, 00Ah						;	je		_proc_end

										;WAIT VSYNC

										;_jmp_st_1:
	DB 0ECh 							;	in		al, (dx)
	DB 024h, 008h						;	and 	al, 08h
	DB 075h, 0FBh						;	jnz 	_jmp_st_1
										;_jmp_st_2:
	DB 0ECh 							;	in		al, (dx)
	DB 024h, 008h						;	and 	al, 08h
	DB 074h, 0FBh						;	jz	   _jmp_st_2

										;_proc_end:
	DB 05Ah 							;	pop    edx
	DB 059h 							;	pop    ecx
	DB 058h 							;	pop    eax
	DB 0C3h 							;	ret

PMDummy:
	ret

PMTableEnd:



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

IF 0

SEGMENT CODE32 BYTE PUBLIC USE32 'CODE'
		ASSUME	CS:CODE32

_start_window:
	push	eax
	push	ebx
	push	edx
	mov 	ebx, edx
	or		bl, 0C0h
	xor 	bl, 02h
	mov 	dx, 03C4h
	mov 	al, 0Bh
	out 	dx, al
	inc 	edx
	in		al, dx		; new mode
	dec 	edx
	mov 	al, 0Eh
	out 	dx, al
	inc 	edx
	mov 	al, bl
	out 	dx, al
	pop 	edx
	pop 	ebx
	pop 	eax
	ret


_start_pl:
	push	eax
	push	ecx
	push	edx
	push	edi

	test	cx, cx
	jz		NEAR _end_pl
	mov 	al, dl
	mov 	dx, 03C8h
	out 	(dx), al
	inc 	dx
_loop_pl:
	mov 	al, [BYTE PTR es:edi + 2]
	out 	(dx), al
	mov 	al, [BYTE PTR es:edi + 1]
	out 	(dx), al
	mov 	al, [BYTE PTR es:edi]
	out 	(dx), al
	add 	edi, 4
	dec 	cx
	jnz 	NEAR _loop_pl

_end_pl:
	pop    edi
	pop    edx
	pop    ecx
	pop    eax

	ret


_start_st:
	cli

	push	eax
	push	ecx
	push	edx

	shl 	edx, 16
	mov 	dx, cx
	mov 	ecx, edx

	mov 	dx, 03CCh
	in		al, (dx)
	mov 	edx, 03BA03B4h
	and 	al, 001h
	jz		NEAR _jmp_1
	mov 	edx, 03DA03D4h
_jmp_1:
	mov 	ah, cl				; bit 0 to bit 7  startaddr
	mov 	al, 00Dh
	out 	(dx), ax
	mov 	ah, ch				; bit 8 to bit 15 startaddr
	mov 	al, 00Ch
	out 	(dx), ax

	shr 	ecx, 16

	mov 	al, 01Eh			; CRTCModuleTest
	out 	(dx), al
	inc 	dx
	in		al, (dx)
	dec 	dx
	and 	al, 0DFh			; clear bit5
	mov 	ah, cl
	and 	ah, 001h			; bit16 		  startaddr
	shl 	ah, 5
	or		ah, al
	mov 	al, 01Eh
	out 	(dx), ax

	mov 	al, 027h			; CRTHiOrd
	out 	(dx), al
	inc 	dx
	in		al, (dx)
	dec 	dx
	and 	al, 0F8h			; clear bit2 1 0
	mov 	ah, cl
	shr 	ah, 1
	and 	ah, 007h			; bit17 18 19	  startaddr
	or		ah, al
	mov 	al, 027h
	out 	(dx), ax

	shr 	edx, 16
	cmp 	bl, 00h
	je		_proc_end
_jmp_st_1:
	in		al, (dx)
	and 	al, 08h
	jnz 	_jmp_st_1
_jmp_st_2:
	in		al, (dx)
	and 	al, 08h
	jz	   _jmp_st_2
_proc_end:

	pop    edx
	pop    ecx
	pop    eax

	sti
	ret


ENDS CODE32

ENDIF


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;





END

⌨️ 快捷键说明

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