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

📄 define_block.asm

📁 一个十六进制编辑器源代码,cool!
💻 ASM
字号:
	_defineblock	proto:DWORD ,:DWORD ,:DWORD ,:DWORD
.code
;<<<<<<<<<<<<<<<<<<<<<<<<< 定义块 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_defineblock proc @hDlg,uMsg,wParam,lParam
local @szBuf[255]
	mov eax,uMsg
	.if eax==WM_INITDIALOG
		__senddlgmessage 1002,BM_SETCHECK ,TRUE
		push esi
		lea esi,@szBuf
		mov eax,dwBlockStart
		.if dwFileType==FILE_RAM
			add eax,dwRamAddress
		.endif
		invoke wsprintf,esi,addr szFmHexD,eax
		invoke SetDlgItemText,@hDlg,1000,esi
		mov eax,dwBlockEnd
		sub eax,dwBlockStart
		inc eax
		invoke wsprintf,esi,addr szFmHexD,eax
		invoke SetDlgItemText,@hDlg,1003,esi
		pop esi
	.elseif eax==WM_COMMAND
		.if wParam==IDOK
			push esi
			push edi
			invoke _GetInt,@hDlg,1000			
			mov esi,eax
			.if isRam
				sub eax,dwRamAddress
			.endif
			.if eax>dwFileSize || sdword ptr eax<0
				_msgbox ctext("超出范围")
				pop edi
				pop esi
				ret
			.endif
			invoke _GetInt,@hDlg,1003
			mov edi,eax
			__senddlgmessage 1001,BM_GETCHECK ;选中[结束]?
			.if !eax
				add edi,esi
				dec edi
			.endif
			.if esi>edi
				pop edi
				pop esi
				ret
			.endif
			.if isRam;是内存编辑?
				sub esi,dwRamAddress
				sub edi,dwRamAddress
			.endif
			.if sdword ptr esi<0
				xor esi,esi
			.endif
			.if edi>dwFileSize
				mov edi,dwFileSize
			.endif			
			mov dwBlockStart,esi
			mov dwCurPos,esi
			mov dwBlockEnd,edi
			.if esi<g_FirstVisible || esi>g_LastVisible;如果超出可见范围,滚动至可见部分
				shr esi,4
				mov g_TopLine,esi
				call _Scroll2Visible
			.endif
			and FLAG_ALL,not FLAG_BLOCKSEL
			pop edi
			pop esi
			call _ReDraw
			invoke EndDialog,@hDlg,0 
		.endif
	.elseif eax==WM_CLOSE 
		invoke EndDialog,@hDlg,0 
	.else
		xor eax,eax
		ret
	.endif
	mov eax,TRUE 
	ret
_defineblock endp



⌨️ 快捷键说明

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