web-dev-qa-db-ja.com

アセンブリ言語で「MOVAH、4CH」とはどういう意味ですか?

アセンブリコードのほとんどは、次の手順で終了します

MOV AH, 4CH
INT 21H

「MOVAH、4CH」とはどういう意味ですか?

4
Shams Nahid
i know it been 2 years after you posted this.
MOV Code Works Like This: MOV Value1,Value2
It Puts Value2 into Value1 But You can't Move something From Valuable to valuable.
You Can Use This Code Like These:
    Register to Register
    Register to valuable
    valuable to register
.............................
this code that you wrote do puts 4c hexadecimal(=76 decimal) into ah register.
you ask why do we do that?
we always have to put some number(number of the function) into ah register 
when do we are using an interrupt.

on ah=4ch int 21h , the program will terminate control to the 
operating system.(end the program)
And int 21h is a dos interrupt.Example:

ah=9h , dx=offset (string + '$') ,int 21h . writes the string at the cursor position.

ah=6h , ch=starting row,cl=starting column,dh=ending row,dl,=ending 
column,al=number of lines,bh=attribute,int 10h . do clears the defined area and writes 
the attribute on it.

ah=2h , dh=row,dl=column,bh=page number , int 10h

tip: video memory is devided to 8 pages(0 to 7). we're using the 0 page in this example.
.............................

プログラム:

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
1
user11942734