قطعه کد تشخیص جایگاه یک کاراکتر در رشته و چاپ آن جایگاه کاراکتر مورد نظر ( مثلا : کاراکتر اول = s )
.386 .MODEL FLAT ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD INCLUDE io.h ; header file for input/output cr EQU 0dh ; carriage return character Lf EQU 0ah ; line feed .STACK 4096 ; reserve 4096-byte stack .DATA ; reserve storage for data prompt1 BYTE "Enter String: ", 0 prompt2 BYTE "Enter char: ", 0 voroodi BYTE 40 DUP (?) voroodiChar BYTE 40 DUP (?) label1 BYTE cr, Lf, "The i is " sum BYTE 11 DUP (?) BYTE cr, Lf, 0 label2 BYTE cr, Lf, "The char is " char BYTE 11 DUP (?) BYTE cr, Lf, 0 label3 BYTE cr, Lf, "Length Of Your String is " lengthChar BYTE 11 DUP (?) BYTE cr, Lf, 0 .CODE ; start of main program code _start: output prompt2 ; prompt for first number input voroodiChar, 40 ; read ASCII characters output prompt1 ; prompt for first number input voroodi, 40 ; read ASCII characters mov edx,offset voroodi mov ecx,0 f: mov al,[edx] cmp al,0 je endF cmp al,voroodiChar jne endCmp mov char, al ; convert to ASCII characters output label2 ; output label and sum dtoa sum, ecx ; convert to ASCII characters output label1 ; output label and sum endCmp: inc ecx inc edx jmp f endF: dtoa lengthChar, ecx ; convert to ASCII characters output label3 ; output label and sum INVOKE ExitProcess, 0 ; exit with return code 0 PUBLIC _start ; make entry point public END ; end of source code