一个库,名字先这样定着
;Disp_Str-------------------------------------------------------------
Disp_Str:
push ebp
mov ebp,esp
push eax
push ebx
push esi
push edi
mov esi,[ebp + 8]
mov edi,[Disp_Pos]
.begin:
lodsb
test al,al
je .exit
cmp al,0ah
jne .disp
push eax
mov eax,edi
mov bl,160
div bl
and ax,0ffh
inc ax
mov bl,160
mul bl
mov edi,eax
pop eax
jmp .begin
.disp:
mov ah,0ch
mov [gs:edi],ax
add edi,2
jmp .begin
.exit:
mov [Disp_Pos],edi
pop edi
pop esi
pop ebx
pop eax
pop ebp
ret 4
;end of Disp_Str------------------------------------------------------
;Disp_Return----------------------------------------------------------
Disp_Return:
push ebp
mov ebp,esp
push Return
call Disp_Str
pop ebp
ret
;end of Disp_Return---------------------------------------------------
;Disp_Al--------------------------------------------------------------
Disp_Al:
push eax
push ecx
push edi
mov edi,[Disp_Pos]
mov ecx,2
push eax
shr al,4
.loop:
and al,0fh
cmp al,9
ja .letter
add al,'0'
jmp .disp
.letter:
sub al,10
add al,'A'
.disp:
mov ah,0ch
mov [gs:edi],ax
add edi,2
cmp ecx,1
je .exit
pop eax
loop .loop
.exit:
mov [Disp_Pos],edi
pop edi
pop ecx
pop eax
ret
;end of Disp_Al-------------------------------------------------------
;Disp_32Bit_Int-------------------------------------------------------
Disp_32Bit_Int:
push ebp
mov ebp,esp
push eax
push esi
mov esi,[ebp + 8]
mov eax,[esi]
rol eax,8
call Disp_Al
rol eax,8
call Disp_Al
rol eax,8
call Disp_Al
rol eax,8
call Disp_Al
pop esi
pop eax
pop ebp
ret 4
;end of Disp_32Bit_Int------------------------------------------------
;Memory_Copy----------------------------------------------------------
;C函数 Mem_Copy(void *esi,void *edi,len ecx)
;ds:esi -> es:edi
;调用前默认ds,es已经填入
Memory_Copy:
push ebp
mov ebp,esp
push ebx
push ecx
push esi
push edi
mov ecx,[ebp + 16]
mov edi,[ebp + 12]
mov esi,[ebp + 8]
.1:
cmp ecx,0
je .2
mov byte bl,[ds:esi]
inc esi
mov byte [es:edi],bl
inc edi
dec ecx
jmp .1
.2:
pop edi
pop esi
pop ecx
pop ebx
pop ebp
ret 12
;end of Memory_Copy---------------------------------------------------