Answer the question
In order to leave comments, you need to log in
"Jump if equal" not working?
I can't figure out why my code is not working properly:
section .data
ok: db "Счетчик аргументов равен 1" , 10, 13, 0
err: db "Счетчик аргументов не равен 1" , 10, 13, 0
section .text
global _start
_start:
mov rax, [rsp]
cmp rax, 2 ;если ARGC == 1
jne [email protected]
mov rcx, ok
mov rax, 1
mov rdi, 1
mov rdx, 1
[email protected]: ;вывести 'Счетчик аргументов равен 1\r\n' в консоль
cmp [rcx], dword 0
je [email protected] ;Эта строка
mov rsi, rcx
push rcx
syscall
pop rcx
inc rcx
jmp [email protected]
[email protected]:
jmp [email protected]
[email protected]: ;если ARGC !== 1
mov rcx, err
mov rax, 1
mov rdi, 1
mov rdx, 1
[email protected]: ;вывести 'Счетчик аргументов не равен 1\r\n'
cmp [rcx], dword 0
je [email protected]
mov rsi, rcx
push rcx
syscall
pop rcx
inc rcx
jmp [email protected]
[email protected]:
[email protected]: ;и выйти
mov rax, 60
mov rdi, 0
syscall
./test
, it says "Argument count not equal to 1" (expected behavior). ./test abcd
, then the console displaysСчетчик аргументов равен 1
Счетчик аргументов не равен 1
Answer the question
In order to leave comments, you need to log in
When the byte at address RCX is zero and the program reaches the line `je [email protected]`, the JE instruction simply does not jump to the label `[email protected]`.
Why?
cmp [rcx], dword 0
- it's generally a strange record. It would be canonical to write cmp dword ptr [rcx], 0
. But in any case, you are not comparing "a byte at the address RCX" with 0, but a whole word. Well, between the lines ok and err there is no whole word of zeros, but after err, obviously, there are. cmp byte ptr [rcx], 0
So the question arose of how to do something similar on your own. Not a copy, but the principle itself - concise pages, a minimum of unnecessary information, fast loading, convenient order forms (displaying discount and price parameters while filling out the form), and so on.
in principle, this can be written with basic knowledge of html + css + php + js (and all this at the level of copy-paste + learning the basics), i.e. to study + write.
What is there is literally the basics that you will find in books for beginners or on sites (except for js, but here you can use ready-made libraries and scripts). if you need to be directed or described in more detail, write in the comments to this answer, I will give contacts for communication
after you learn html css js, it's time to take a look at https://webasyst.ru
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question