汇编语言中的"MOV AH, 4CH"是什么意思?
What does it mean by "MOV AH, 4CH" in assembly language?
大部分汇编代码由以下指令终止
MOV AH, 4CH
INT 21H
"MOV AH, 4CH" 是什么意思?
MOV AH, 4CH
表示存储(或“移动”(w)) the hexadecimal value 4C
into register (w) AH
.
(请注意,动词“移动”在历史上被使用过,但对于动词来说这是一个相当不幸的选择,因为当你移动某物时,它不再存在于它的旧位置并且只能找到在它的新位置,而实际上所有“移动”指令实际上 copy 数据:指令完成后,可以在两个位置找到值。令人惊讶的是,在一个学科中需要如此多的逻辑,人们使用的语言可能如此不合逻辑。)
INT 21H
表示调用十六进制数21
.
标识的中断(w)
这就是“汇编语言中的“MOV AH, 4CH”是什么意思?”这个问题的答案。但是,我很确定 OP 并不是要问这在汇编语言中意味着什么; OP 可能是想问它在 MS-DOS 中的含义。
所以,就是这样:
MS-DOS(或者现在更可能是模拟 MS-DOS 的东西)捕获中断 21h 的调用并执行一些操作系统相关的功能,这些功能由寄存器 AH
.[=21 的值标识=]
根据 MS-DOS API (w),在 AH
= 4Ch 时调用中断 21h 会导致当前进程终止并使用寄存器 AL
的值作为进程的退出代码。
DOS 中断 int 21/4Ch 是 EXIT - TERMINATE WITH RETURN CODE, al
的内容用作 return 代码,进程终止。该文档附带以下注释:
Unless the process is its own parent (see #01378 [offset 16h] at AH=26h), all open files are closed and all memory belonging to the process is freed. All network file locks should be removed before calling this function
MOV
代码是这样工作的:MOV Value1,Value2
.
它将 Value2
放入 Value1
。但是你不能在内存中将某些东西从一个变量移动到另一个变量。
您可以像这样使用此代码:
- 注册就注册
- 注册到内存
- 要注册的内存
您编写的这段代码将 4c
十六进制(=76 十进制)放入 ah
寄存器。
你问我们为什么要那样做?
我们总是要将一些数字(函数的数字)放入 ah 寄存器
当我们使用中断时。
on ah=4ch int 21h
,程序将终止对
操作系统。(结束程序)
int 21h
是一个dos interrupt.Example:
ah=9h , dx=offset (string + '$') ,int 21h
。在光标位置写入字符串。
ah=6h
, ch
=起始行,cl
=起始列,dh
=结束行,dl
=结束
column,al
=行数,bh
=属性,int 10h
清空定义区域并写入
上面的属性。
ah=2h , dh=row,dl=column,bh=page number , int 10h
提示:显存分为8页(0到7)。我们在此示例中使用 0 页。
程序:
datasg segment para 'data'
msg db 'Hello world$'
datasg ends
codesg segment para 'code'
example proc far
assume cs:codesg,ds:datasg ;lead the assembler to know the segments.
mov ax,datasg ;this is because ds cannot be vaulued directly.
mov ds,ax ;move the data segment offset to its register.
mov ah,6h
mov al,25
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,0fh
int 10h
mov ah,2h
mov dh,2
mov dl,4
mov bh,0
int 10h
mov ah,9h
mov dx,offset msg
int 21h
mov ah,8h
int 21h
mov ah,4ch
int 21h
example endp
codesg ends
end main
大部分汇编代码由以下指令终止
MOV AH, 4CH
INT 21H
"MOV AH, 4CH" 是什么意思?
MOV AH, 4CH
表示存储(或“移动”(w)) the hexadecimal value 4C
into register (w) AH
.
(请注意,动词“移动”在历史上被使用过,但对于动词来说这是一个相当不幸的选择,因为当你移动某物时,它不再存在于它的旧位置并且只能找到在它的新位置,而实际上所有“移动”指令实际上 copy 数据:指令完成后,可以在两个位置找到值。令人惊讶的是,在一个学科中需要如此多的逻辑,人们使用的语言可能如此不合逻辑。)
INT 21H
表示调用十六进制数21
.
这就是“汇编语言中的“MOV AH, 4CH”是什么意思?”这个问题的答案。但是,我很确定 OP 并不是要问这在汇编语言中意味着什么; OP 可能是想问它在 MS-DOS 中的含义。
所以,就是这样:
MS-DOS(或者现在更可能是模拟 MS-DOS 的东西)捕获中断 21h 的调用并执行一些操作系统相关的功能,这些功能由寄存器 AH
.[=21 的值标识=]
根据 MS-DOS API (w),在 AH
= 4Ch 时调用中断 21h 会导致当前进程终止并使用寄存器 AL
的值作为进程的退出代码。
DOS 中断 int 21/4Ch 是 EXIT - TERMINATE WITH RETURN CODE, al
的内容用作 return 代码,进程终止。该文档附带以下注释:
Unless the process is its own parent (see #01378 [offset 16h] at AH=26h), all open files are closed and all memory belonging to the process is freed. All network file locks should be removed before calling this function
MOV
代码是这样工作的:MOV Value1,Value2
.
它将 Value2
放入 Value1
。但是你不能在内存中将某些东西从一个变量移动到另一个变量。
您可以像这样使用此代码:
- 注册就注册
- 注册到内存
- 要注册的内存
您编写的这段代码将 4c
十六进制(=76 十进制)放入 ah
寄存器。
你问我们为什么要那样做?
我们总是要将一些数字(函数的数字)放入 ah 寄存器
当我们使用中断时。
on ah=4ch int 21h
,程序将终止对
操作系统。(结束程序)
int 21h
是一个dos interrupt.Example:
ah=9h , dx=offset (string + '$') ,int 21h
。在光标位置写入字符串。
ah=6h
, ch
=起始行,cl
=起始列,dh
=结束行,dl
=结束
column,al
=行数,bh
=属性,int 10h
清空定义区域并写入
上面的属性。
ah=2h , dh=row,dl=column,bh=page number , int 10h
提示:显存分为8页(0到7)。我们在此示例中使用 0 页。
程序:
datasg segment para 'data'
msg db 'Hello world$'
datasg ends
codesg segment para 'code'
example proc far
assume cs:codesg,ds:datasg ;lead the assembler to know the segments.
mov ax,datasg ;this is because ds cannot be vaulued directly.
mov ds,ax ;move the data segment offset to its register.
mov ah,6h
mov al,25
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,0fh
int 10h
mov ah,2h
mov dh,2
mov dl,4
mov bh,0
int 10h
mov ah,9h
mov dx,offset msg
int 21h
mov ah,8h
int 21h
mov ah,4ch
int 21h
example endp
codesg ends
end main