向cnzdgs大侠等人请教下面这些汇编代码中标注的内容是什么意思

捕鲸叉 2009-02-09 07:29:11
下面的代码是Vc8里CRT中的,对我加了;>>>>>>>>>>>>>>>>>这样标注的地方不了解,请指教,谢谢


page ,132 ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
title memset - set sections of memory all to one byte;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;***
;memset.asm - set a section of memory to all one byte
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
;Purpose:
; contains the memset() routine
;
;*******************************************************************************

.xlist
include cruntime.inc
.list

page
;***
;char *memset(dst, value, count) - sets "count" bytes at "dst" to "value"
;
;Purpose:
; Sets the first "count" bytes of the memory starting
; at "dst" to the character value "value".
;
; Algorithm:
; char *
; memset (dst, value, count)
; char *dst;
; char value;
; unsigned int count;
; {
; char *start = dst;
;
; while (count--)
; *dst++ = value;
; return(start);
; }
;
;Entry:
; char *dst - pointer to memory to fill with value
; char value - value to put in dst bytes
; int count - number of bytes of dst to fill
;
;Exit:
; returns dst, with filled bytes
;
;Uses:
;
;Exceptions:
;
;*******************************************************************************

CODESEG ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

extrn _VEC_memzero:near
extrn __sse2_available:dword

public memset
memset proc \
dst:ptr byte, \
value:byte, \
count:dword

OPTION PROLOGUE:NONE, EPILOGUE:NONE ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

.FPO ( 0, 3, 0, 0, 0, 0 ) ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

mov edx,[esp + 0ch] ; edx = "count"
mov ecx,[esp + 4] ; ecx points to "dst"

test edx,edx ; 0?
jz short toend ; if so, nothing to do

xor eax,eax
mov al,[esp + 8] ; the byte "value" to be stored

; Special case large block zeroing using SSE2 support
test al,al ; memset using zero initializer?
jne dword_align
cmp edx,0100h ; block size exceeds size threshold?
jb dword_align
cmp DWORD PTR __sse2_available,0 ; SSE2 supported?
je dword_align

jmp _VEC_memzero ; use fast zero SSE2 implementation
; no return

; Align address on dword boundary
dword_align:

push edi ; preserve edi
mov edi,ecx ; edi = dest pointer

cmp edx,4 ; if it's less then 4 bytes
jb tail ; tail needs edi and edx to be initialized

neg ecx
and ecx,3 ; ecx = # bytes before dword boundary
jz short dwords ; jump if address already aligned

sub edx,ecx ; edx = adjusted count (for later)
adjust_loop:
mov [edi],al
add edi,1
sub ecx,1
jnz adjust_loop

dwords:
; set all 4 bytes of eax to [value]
mov ecx,eax ; ecx=0/0/0/value
shl eax,8 ; eax=0/0/value/0

add eax,ecx ; eax=0/0val/val

mov ecx,eax ; ecx=0/0/val/val

shl eax,10h ; eax=val/val/0/0

add eax,ecx ; eax = all 4 bytes = [value]

; Set dword-sized blocks
mov ecx,edx ; move original count to ecx
and edx,3 ; prepare in edx byte count (for tail loop)
shr ecx,2 ; adjust ecx to be dword count
jz tail ; jump if it was less then 4 bytes

rep stosd
main_loop_tail:
test edx,edx ; if there is no tail bytes,
jz finish ; we finish, and it's time to leave
; Set remaining bytes

tail:
mov [edi],al ; set remaining bytes
add edi,1

sub edx,1 ; if there is some more bytes
jnz tail ; continue to fill them

; Done
finish:
mov eax,[esp + 8] ; return dest pointer
pop edi ; restore edi

ret

toend:
mov eax,[esp + 4] ; return dest pointer

ret

memset endp

end
...全文
194 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cnzdgs 2009-02-09
  • 打赏
  • 举报
回复
这些基本都是控制程序清单的伪指令。
PAGE用来指定页的长度和宽度,逗号前面表示长度,后面表示宽度,“,132”是只指定了宽度为132。
TITLE是定义标题,其后面的文字就是标题内容。
CODESEG是cruntime.inc中定义的宏:
codeseg MACRO
if sizeC
.code _TEXT
else
.code
endif
ifdef I386
assume ds:FLAT
assume es:FLAT
assume ss:FLAT
endif
ENDM

OPTION是设置选项,“PROLOGUE:NONE, EPILOGUE:NONE”表示不要序言和尾声。
.FPO我也搞不清楚,你查MSDN吧。
xtdumpling 2009-02-09
  • 打赏
  • 举报
回复
mark,学习
nineforever 2009-02-09
  • 打赏
  • 举报
回复
参见MSDN
Microsoft Macro Assembler Reference
Directives Reference
内容概要:本文围绕“空地多无人平台协同路径规划技术”的论文复现展开,重点介绍了基于Matlab的多无人机与地面无人平台协同路径规划的算法实现与仿真研究。研究系统性地整合了无人机三维路径规划、动态避障、多机协同、任务分配及防撞机制等核心技术,结合智能优化算法(如遗传算法、粒子群算法、灰狼优化算法等)与经典路径规划模型(如Dubins路径、A*、RRT等),在复杂威胁环境下实现了高效、安全的协同路径规划。文提供了完整的Matlab代码支持,便于科研人员进行算法验证、性能对比与二次开发,并强调通过复现高水平学术论文(如EI、SCI期刊及硕博论文)深入掌握该领域的前沿方法与技术路线。; 适合人群:具备一定Matlab编程基础,从事无人机系统、自动化控制、人工智能、路径规划等相关领域研究的研究生、科研人员及工程技术人员,尤其适用于正在开展科研项目、撰写学位论文或希望提升算法实践能力的研究者。; 使用场景及目标:① 复现并深入理解空地协同路径规划领域的高水平论文算法;② 掌握Matlab在多智能体路径规划的建模、仿真与可视化方法;③ 应用于科研课题、毕业设计、项目申报及算法创新实践,提升研究的技术深度与工程可行性。; 阅读建议:建议结合文提供的网盘资源(含完整代码、仿真模型及参考文献资料)同步学习,优先选择与自身研究方向契合的案例进行复现,注重算法原理与代码实现之间的映射关系,并在掌握基础方案后尝试进行参数调优、算法融合或引入新约束条件以实现改进与创新。

21,500

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧