Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Two functions, just differing in their order of parameters. It's... convenient, I guess?
- Loading branch information
Showing
16 changed files
with
96 additions
and
1,127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
; void __cdecl setmem(void *addr, unsigned int len, char val) | ||
public _setmem | ||
_setmem proc DIST | ||
@@addr = dword ptr 6 | ||
@@len = word ptr 0Ah | ||
@@val = byte ptr 0Ch | ||
|
||
push bp | ||
mov bp, sp | ||
push si | ||
push di | ||
LES_ di, [bp+@@addr] | ||
mov cx, [bp+@@len] | ||
mov al, [bp+@@val] | ||
mov ah, al | ||
cld | ||
test di, 1 | ||
jz short @@isAligned | ||
jcxz short @@done | ||
stosb | ||
dec cx | ||
|
||
@@isAligned: | ||
shr cx, 1 | ||
rep stosw | ||
jnb short @@noOdd | ||
stosb | ||
|
||
@@noOdd: | ||
@@done: | ||
pop di | ||
pop si | ||
pop bp | ||
ret | ||
_setmem endp | ||
|
||
; void *__cdecl memset(void *src, int c, size_t n) | ||
public _memset | ||
_memset proc DIST | ||
@@src = dword ptr 6 | ||
@@c = byte ptr 0Ah | ||
@@n = word ptr 0Ch | ||
|
||
push bp | ||
mov bp, sp | ||
push si | ||
push di | ||
push word ptr [bp+@@c] | ||
push [bp+@@n] | ||
push word ptr [bp+@@src+2] | ||
push word ptr [bp+@@src] | ||
call _setmem | ||
add sp, 8 | ||
mov dx, word ptr [bp+@@src+2] | ||
mov ax, word ptr [bp+@@src] | ||
pop di | ||
pop si | ||
pop bp | ||
ret | ||
_memset endp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.