P
P
Pasha2015-11-05 21:02:45
assembler
Pasha, 2015-11-05 21:02:45

I don't understand why the label doesn't work as masm32 needs?

.486
.model flat, stdcall
option casemap :none ;
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\kernel32.inc
include \masm32\macros\macros.asm includelib
\masm32\lib\masm32.lib
includelib \masm32\lib\kernel32.lib
.data
i db "T ro Ps",0
j db ?
pr dd 20h
zero dd 0
.code
start:
xor ecx,ecx
mov eax,offset i
mov ebx,zero
next:cmp eax,pr
jne nextEl; if the space is equal to an element of the line, then it should go to the next line, and
; jumps anyway to label nextEl
add ebx,1
cmp ebx,1
jg delElement
jmp nextEl
nextEl:
mov eax,[eax+1]
jmp next
delElement:
cmp eax,pr
jne mover
mov eax,[eax+1]
mover:
mov edx,eax
mov eax,[eax+1]
end start

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2015-11-05
@PauloDinosaur

mov eax,offset i
mov ebx,zero
next:cmp eax,pr
jne nextEl; если пробел равен элементу строки то должно перейти на следующую строку

... and meanwhile, the address of the string and the address of the variable containing a space are compared.
It should be something like this:
mov eax,offset i
mov ebx,zero
next:cmp byte ptr [eax], 20h
jne nextEl

Further code is also junk.
Learn how different types of addressing are written in your assembler. For example: www.c-jump.com/CIS77/ASM/Addressing/lecture.html#R...

P
Pasha, 2015-11-05
@PauloDinosaur

The task of the program:
Counting spaces in a string, if there are more than 1 spaces, then you need to remove all spaces

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question