Assembly Language for Beginners

(nextflipdebug2) #1

3.29. WINDOWS 16-BIT


void PASCAL remove_digits (char s)
{
while (
s)
{
if (s>='0' && s<='9')
*s='-';
s++;
};
};


char str[]="hello 1234 world";


int PASCAL WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
{
string_compare ("asd", "def");
string_compare_far ("asd", "def");
remove_digits (str);
MessageBox (NULL, str, "caption", MB_YESNOCANCEL);
return 0;
};


string_compare proc near


arg_0 = word ptr 4
arg_2 = word ptr 6


push bp
mov bp, sp
push si
mov si, [bp+arg_0]
mov bx, [bp+arg_2]

loc_12: ; CODE XREF: string_compare+21j
mov al, [bx]
cmp al, [si]
jz short loc_1C
xor ax, ax
jmp short loc_2B


loc_1C: ; CODE XREF: string_compare+Ej
test al, al
jz short loc_22
jnz short loc_27


loc_22: ; CODE XREF: string_compare+16j
mov ax, 1
jmp short loc_2B


loc_27: ; CODE XREF: string_compare+18j
inc bx
inc si
jmp short loc_12


loc_2B: ; CODE XREF: string_compare+12j
; string_compare+1Dj
pop si
pop bp
retn 4
string_compare endp


string_compare_far proc near ; CODE XREF: WinMain+18p


arg_0 = word ptr 4

Free download pdf