13.2.1.2 - 3


push str1

push 0

call MessageBoxA

endm

Ideal

p586

model flat

extrn ExitProcess:proc

extrn MessageBoxA:proc

include "win.inc"

dataseg

t db 'Information', 0

text db 'Hello, world!', 0

codeseg

begin:

ShowMessage <offset text>, <offset t>, 0

call ExitProcess

end begin

2. gets , . - <Enter>.

ideal

p586

model flat

include "win.inc"

extrn GetStdHandle:proc

extrn ReadConsoleA: proc

codeseg

proc gets

public gets

arg mystr:dword

local s:dword=r

push ebp

mov ebp, esp

sub esp, r

push ebx ecx

push STD_INPUT_HANDLE

call GetStdHandle; ebp-0; eip-4; ;&str-8

mov ebx, [ebp+8]

push 0

lea ecx, [ebp-4]

push ecx

push 80 ebx eax

call ReadConsoleA

sub [s], 2

add ebx, [s]

mov [byte ptr ebx], 0

mov eax, [ebp+8]

pop ecx ebx

mov esp, ebp

pop ebp

ret 4

endp

end

:

ideal

p386

model flat

extrn ExitProcess:proc

extrn GetStdHandle:proc

extrn ReadConsoleA:proc

extrn WriteConsoleA:proc

extrn gets:proc

dataseg

include "win.inc"

din dd 0

dout dd 0

buf db 80 dup (?)

siz dd ?

mystr db 'Input string, please', 13, 10, 0

codeseg

begin:

push STD_INPUT_HANDLE

call GetStdHandle

mov [din], eax

push STD_OUTPUT_HANDLE

call GetStdHandle

mov [dout], eax

push 0 offset siz 22 offset mystr [dout]

call WriteConsoleA

push offset buf

call gets

call ExitProcess

end begin

3.