Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include "pch.h"
- #include <iostream>
- using namespace std;
- int nrTok(char*);
- int main()
- {
- char s[] = "cuv1 cuv2.cuv3,cuv4 . , cuv5 CUV6";
- cout << nrTok((char*)s);
- return 0;
- }
- int nrTok(char*)
- {
- // ebx=sir de caractere
- // ecx=i
- // eax=nr cuv
- // esi=un fel de bool care verifica daca ultimul element e separator sau nu (0 daca e, respectiv 1)
- _asm {
- mov ebx, [ebp + 8]
- mov ecx, 0
- mov esi, 0
- mov eax, 0
- forInceput:
- mov dl, [ebx + ecx]
- cmp dl, 0
- je forStop
- cmp dl,' '
- je eSeparator
- cmp dl,','
- je eSeparator
- cmp dl,'.'
- je eSeparator
- //daca nu a sarit inseamna ca e litera -> verificam daca elem de pe poz anterioara e separator ptr a face eax++
- cmp esi,0
- jne sariPeste
- inc eax
- sariPeste:
- mov esi,1
- inc ecx
- jmp forInceput
- eSeparator:
- mov esi,0
- inc ecx
- jmp forInceput
- forStop :
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement