Assembly Language for Beginners

(Jeff_L) #1

3.29. WINDOWS 16-BIT


push ds
mov ax, offset aCaption ; "caption"
push ax
xor ax, ax
push ax
call MESSAGEBOX
loc_57:
xor ax, ax
pop bp
retn 0Ah
WinMain endp


Somewhat extended example from the previous section.


3.29.4 Example #4.


#include <windows.h>


int PASCAL func1 (int a, int b, int c)
{
return a*b+c;
};


long PASCAL func2 (long a, long b, long c)
{
return a*b+c;
};


long PASCAL func3 (long a, long b, long c, int d)
{
return a*b+c-d;
};


int PASCAL WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
{
func1 (123, 456, 789);
func2 (600000, 700000, 800000);
func3 (600000, 700000, 800000, 123);
return 0;
};


func1 proc near


c = word ptr 4
b = word ptr 6
a = word ptr 8


push bp
mov bp, sp
mov ax, [bp+a]
imul [bp+b]
add ax, [bp+c]
pop bp
retn 6
func1 endp


func2 proc near


arg_0 = word ptr 4
arg_2 = word ptr 6
arg_4 = word ptr 8
arg_6 = word ptr 0Ah
arg_8 = word ptr 0Ch
arg_A = word ptr 0Eh

Free download pdf