Assembly 程序集-Debug.exe-通过调试更改数据会导致操作系统/应用程序失败吗?
我开始学习汇编语言。我只想澄清一件事: 通过调试更改数据会导致我的操作系统/应用程序失败吗 我已经通过cmd运行了debug并完成了E命令Assembly 程序集-Debug.exe-通过调试更改数据会导致操作系统/应用程序失败吗?,assembly,Assembly,我开始学习汇编语言。我只想澄清一件事: 通过调试更改数据会导致我的操作系统/应用程序失败吗 我已经通过cmd运行了debug并完成了E命令 E 100 在这里,我使用space查看内存中存储在以下位置的内容: 0B79:0100 BE. 90. 02. ... etc 覆盖这些内存空间会导致当前运行的系统出错吗 启动时,Debug将65k字节的内存分配为一个工作区,前100个字节是PSP。我的问题可能更直接地是: 是我正在查看的未分配内存或操作系统/应用程序正在使用的内存的工作区
E 100
在这里,我使用space
查看内存中存储在以下位置的内容:
0B79:0100 BE. 90. 02. ... etc
覆盖这些内存空间会导致当前运行的系统出错吗
启动时,Debug将65k字节的内存分配为一个工作区,前100个字节是PSP。我的问题可能更直接地是:
是我正在查看的未分配内存或操作系统/应用程序正在使用的内存的工作区
再次请原谅我的新手,这毕竟是我与汇编语言的关系。我认为这是一个64 KB的未分配内存段。 通过调试,我们可以简单地构建一个*.com应用程序,但通常不能构建一个*.exe 通过使用汇编程序,我们可以构建*.exe应用程序。 在*.exe中,我们可以以实心形式保留一个代码段、一个数据段和一个堆栈段。 如果一个DOS应用程序正在启动,那么DOS会将所有可用内存提供给该应用程序,但我们不知道有多少内存段是可用的,并且位于哪个地址上。 为了分配更多内存,我们可以在第一步中释放所有未使用的内存,在第二步中,我们可以分配更多内存
SETFREE: mov bx, ss ; Using for *.exe:
mov ax, es ; calculating the number of paragraps from
sub bx, ax ; the PSP to the beginning of the stack
mov ax, sp ; + adding the length of the stack
add ax, 0Fh
shr ax, 4
add bx, ax
mov ah, 4Ah
int 21h
ret
;---------------------------------------------------------------------------
GETSPACE: mov ah, 48h ; BX = number of paragraphs
int 21h
ret ; Return: AX = segment
RBIL->inter61b.zip->INTERRUP.G
--------D-2148-------------------------------
INT 21 - DOS 2+ - ALLOCATE MEMORY
AH = 48h
BX = number of paragraphs to allocate
Return: CF clear if successful
AX = segment of allocated block
CF set on error
AX = error code (07h,08h) (see #01680 at AH=59h/BX=0000h)
BX = size of largest available block
Notes: DOS 2.1-6.0 coalesces free blocks while scanning for a block to
allocate
.COM programs are initially allocated the largest available memory
block, and should free some memory with AH=49h before attempting any
allocations
under the FlashTek X-32 DOS extender, EBX contains a protected-mode
near pointer to the allocated block on a successful return
SeeAlso: AH=49h,AH=4Ah,AH=58h,AH=83h
--------D-2149-------------------------------
INT 21 - DOS 2+ - FREE MEMORY
AH = 49h
ES = segment of block to free
Return: CF clear if successful
CF set on error
AX = error code (07h,09h) (see #01680 at AH=59h/BX=0000h)
Notes: apparently never returns an error 07h, despite official docs; DOS 2.1+
code contains only an error 09h exit
DOS 2.1-6.0 does not coalesce adjacent free blocks when a block is
freed, only when a block is allocated or resized
the code for this function is identical in DOS 2.1-6.0 except for
calls to start/end a critical section in DOS 3.0+
SeeAlso: AH=48h,AH=4Ah
--------D-214A-------------------------------
INT 21 - DOS 2+ - RESIZE MEMORY BLOCK
AH = 4Ah
BX = new size in paragraphs
ES = segment of block to resize
Return: CF clear if successful
CF set on error
AX = error code (07h,08h,09h) (see #01680 at AH=59h/BX=0000h)
BX = maximum paragraphs available for specified memory block
Notes: under DOS 2.1-6.0, if there is insufficient memory to expand the block
as much as requested, the block will be made as large as possible
DOS 2.1-6.0 coalesces any free blocks immediately following the block
to be resized
SeeAlso: AH=48h,AH=49h,AH=83h