flat assembler
Message board for the users of flat assembler.
Index
> Main > Count the number of a particular character in a string Goto page Previous 1, 2, 3, 4 Next |
Author |
|
MariaSM 05 May 2014, 15:25
how can I make this? where I'm supposed to put these instructions in the program?
and about pos? how could I declare it? |
|||
05 May 2014, 15:25 |
|
sid123 05 May 2014, 15:40
I'm totally confused after reading the entire topic so I'll follow what the header says.
Quote: Count the number of a particular character in a string Code: ; Usage : ; E(SI) - Pointer to string ; BL - Character ; OUT: E(CX) number of characters count_num_of_chars_in_string: ; save registers pushfd ; save flags will be altered by cmp push eax push esi xor ECX, ECX ; make ECX 0 .loop: lodsb cmp al, bl je .found_char cmp al, 0 je .done jmp .loop .found_char: inc ECX jmp .loop .done: pop esi pop eax popfd ret Untested. _________________ "Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X XD |
|||
05 May 2014, 15:40 |
|
AsmGuru62 05 May 2014, 16:58
Oh, My!..
Your post adds some more confusion!.. good work, however. P.S. The code below actually compiles!.. wow!.. FASM is awesome! Too forgiving. A coder who uses code label ".loop:" must be punished! Code:
.loop:
loop .loop
|
|||
05 May 2014, 16:58 |
|
MariaSM 05 May 2014, 18:48
AsmGuru62 wrote: Then you need an array of positions and a counter of how many stored: It gives me a error at Code: MOV SI, ARRPOS |
|||
05 May 2014, 18:48 |
|
AsmGuru62 05 May 2014, 18:53
Oh... right, in MASM you use OFFSET in front of the name. Just use OFFSET ARRPOS.
|
|||
05 May 2014, 18:53 |
|
MariaSM 05 May 2014, 19:10
AsmGuru62 wrote: Oh... right, in MASM you use OFFSET in front of the name. Just use OFFSET ARRPOS. can you help me with the entire program? after I read the string and the character I receive a error: "16bit MS-DOS subsystem" I attached the program Last edited by MariaSM on 07 May 2014, 13:14; edited 2 times in total |
|||
05 May 2014, 19:10 |
|
AsmGuru62 05 May 2014, 19:49
I have FASM, and you use MASM.
I can try however... |
|||
05 May 2014, 19:49 |
|
MariaSM 05 May 2014, 19:53
AsmGuru62 wrote: I have FASM, and you use MASM. thanks a lot! |
|||
05 May 2014, 19:53 |
|
JohnFound 05 May 2014, 21:23
It is really funny how strongly impacts a female nickname in an assembly programmers forum...
Here we have even a "photo" of MariaSM, but the stack overflow users are not so naive. |
|||
05 May 2014, 21:23 |
|
AsmGuru62 05 May 2014, 21:36
Actually, I'll help anyone, female or not.
Please take a look at the code:
|
|||||||||||
05 May 2014, 21:36 |
|
fasmnewbie 05 May 2014, 21:53
AsmGuru62 wrote: Actually, I'll help anyone, female or not. Guru, I copied your code for demonstration. Hope its ok http://board.flatassembler.net/topic.php?t=16708 |
|||
05 May 2014, 21:53 |
|
fasmnewbie 05 May 2014, 21:55
MariaSM wrote:
Maria, do you need anything else? :p |
|||
05 May 2014, 21:55 |
|
fasmnewbie 05 May 2014, 21:57
JohnFound wrote: It is really funny how strongly impacts a female nickname in an assembly programmers forum... I don't know man. Guru never helped me this much. hehehe |
|||
05 May 2014, 21:57 |
|
revolution 05 May 2014, 23:35
AsmGuru62 wrote: A coder who uses code label ".loop:" must be punished! |
|||
05 May 2014, 23:35 |
|
revolution 06 May 2014, 02:05
JohnFound wrote: It is really funny how strongly impacts a female nickname in an assembly programmers forum... |
|||
06 May 2014, 02:05 |
|
JohnFound 06 May 2014, 05:19
revolution wrote: Perhaps it doesn't matter if the photo is real or not. Just the idea seems to be enough to elicit more positive responses. Maybe you should change your name to JaneFound and get more help with Fresh? And maybe I should change my name to SexyNerdyChick and post a picture of Natalie Portman? Yes, indeed. JaneFound - I like it. But no, thanks. BTW, the serious assembly girls actually take male nicknames, or neutral. _________________ Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9 |
|||
06 May 2014, 05:19 |
|
MariaSM 06 May 2014, 06:01
AsmGuru62 wrote: Actually, I'll help anyone, female or not. thank you very much! I really appreciate what you did for me! this program have some bugs..after displaying the correct positions, it displays many other numbers.. Last edited by MariaSM on 06 May 2014, 19:29; edited 1 time in total |
|||
06 May 2014, 06:01 |
|
edfed 06 May 2014, 09:52
count every occurences of every ascii chars, stop on the 0 char
Code: count: times dd 0 ... countChars: ;esi = input asciiZ string .loop: movzx eax,byte[esi] or al,al je .end: inc dword[counts+eax*4] inc esi jmp .loop .end: ret ... getCount: ;al = ascii code to count ;return eax = count movzx eax,al mov eax,[counts+eax*4] ret ... porting this code to 16 bits should not be very hard |
|||
06 May 2014, 09:52 |
|
MariaSM 06 May 2014, 19:32
MariaSM wrote:
I have tried for one or two hours to find what's wrong with the program , but I don't find what doesn't work properly...some help? |
|||
06 May 2014, 19:32 |
|
Goto page Previous 1, 2, 3, 4 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.