Вы находитесь на странице: 1из 7

3

:
520221
: .

2013

1.

:
Microsoft

Macro assembler IA-32-


Microsoft Windows XP.
. ,
exe-.
2.


1) printf

CRT Library ( stdio.inc), prg_01.asm (


prg_02.asm, prg_03.asm) ,
printf C:
) printf("Hello,\nWorld!");
( \n LF 0Ah)
) printf("Hello, %s!",s);
s "World",0
2) prg_04.asm
Windows (MessageBox) , 1-
. ,

C:\520111\>prg_04.exe assembler[Enter]
"Message"
"assembler".
prg_01.asm > prg_05.asm
prg_03.asm > prg_06.asm , :
C:\520111\>prg_05.exe assembler[Enter]
C:\520111\>prg_06.exe assembler[Enter]
:

assembler
Hello, assembler!
.. 1-
.
3.
prg_01.asm

.686
.MODEL
FLAT, C
INCLUDE
stdio.inc
;puts PROTO C :VARARG
.STACK
.DATA
Text1 BYTE "Hello, World!",0
main

main

.CODE
PROC
INVOKE
ret

puts, ADDR Text1

ENDP
END ;program

prg_02.asm

.686
.MODEL
FLAT, C
INCLUDE
stdio.inc
;puts PROTO C :VARARG
.STACK
.DATA
Text1 BYTE "Hello,",0AH,"World!",0

main

.CODE
PROC
INVOKE

puts, ADDR Text1

ret
main

ENDP
END ;program

prg_03.asm
.686
.MODEL
FLAT, C
INCLUDE
stdio.inc
;puts PROTO C :VARARG
.STACK
.DATA
Text1 BYTE "Hello,"
s
BYTE
"World !",0
.CODE
main PROC
push OFFSET s
push OFFSET Text1
call printf
add esp,04h
pop ebp
ret
main ENDP
END ;program

prg_04.asm
.686
.MODEL
INCLUDE

FLAT, C
stdio.inc

MessageBoxA PROTO STDCALL :PTR BYTE, :PTR BYTE, :PTR BYTE, :DWORD
.STACK
.DATA
Title1
Title2

BYTE
BYTE

"Message",0
"Assembler",0

.CODE
main

PROC
INVOKE
RET

main

MessageBoxA,0,addr Title2, ADDR Title1, 0

ENDP
END ; program

prg_05.asm
.686
.MODEL
FLAT, C
INCLUDE
stdio.inc
;puts PROTO C :VARARG
.STACK
.DATA
Text1 dd
main

89456278h

.CODE
PROC n:DWORD, a0:DWORD
mov
ebx, a0
mov
eax,[ebx+4]
mov Text1,eax
push Text1
call printf
ret

main

ENDP
END ;program

prg_06.asm
.686
.MODEL
FLAT, C
INCLUDE
stdio.inc
;puts PROTO C :VARARG
.STACK
.DATA
Text1 dd
s
BYTE
s1 BYTE
main

main

100h
"Hello,",0
"!",0

.CODE
PROC n:DWORD, a0:DWORD
mov
ebx, a0
mov
eax,[ebx+4]
mov Text1,eax
push OFFSET s
call printf
push Text1
call
printf
push OFFSET s1
call
printf
ret
ENDP
END ;program

3.

.
Microsoft

Macro assembler IA-32-


Microsoft Windows XP.

Оценить