Please help me for my learning case.
I want my assembler program to: first read text from console user input, compare it for a string and goes to OK, or BAD depends on the string user type.
My code now looks something like this:
----------------------------
section .data
pass: db "pass"
yeah: db "GREAT",10
yeahl: equ $-yeah
section .bss
type: resb 255
typel: equ $-type
_start:
xor eax, eax ;clear eax
mov eax, 3 ; read input
mov ebx, 1
mov ecx, type
mov edx, typel
int 0x80
cmp eax, pass
je success
int 0x80
leave:
mov eax, 1
mov ebx, 0
int 0x80
success:
mov eax, 4
mov ebx, 1
mov ecx, yeah
mov edx, yeahl
int 0x80
jmp leave
---------
What ever I change things here, it wont make any compare on between the user inputs and my "pass" string. Could anyone advice? :)
Hi ukko,
Welcome to the forum.
int 0x80
The code above is about Linux assembly. Your posting does not fit The Campus section of our forum.
Hi ukko,
What Vortex means is that Linux code is way too complicated for the campus of a Windows forum.
You write "it doesn't compare" - are you sure? Or do you just don't like the result? Under Windows at least, all strings are zero-delimited; if Linux behaves the same, try this:
db "pass", 0
And in any case, use a debugger to see what really happens.
Welcome to the Forum :icon14:
Thanx. :)
I don't like the results, in any circumstances it will skip the test and goes into end?
You wrote "it wont make any compare" - how do you arrive at that result? What DOES your code do instead?
You need two branches in your code, one that prints "strings are equal", the second printing "strings are not equal". And then you need to find out if it prints the correct result.
I want it to make a test if user type in: pass and press enter it goes to text saying GREAT and all other text goes to end, but now it just what ever I change things here it just ends... :(
Don't know what to do to make this test work.