+ 1

How to convert the following code/task to Assembly language?

I want something like this: if(input == 0) not; negate accumulator else mov 0 acc mov acc output slp 1 _________________ Some of this code is already in assembler, but how do I implement the "if" and "else" in a low level assembly language?

27th Sep 2018, 10:19 AM
BraveHornet
BraveHornet - avatar
2 odpowiedzi
+ 1
you would do something like load ds:bx, [input] ;; load ds:bx with the address of input mov ax,ds:[bx] ;; load first byte of input into ax cmp ax,0 ;; see if the first byte is a nul char jnz ZeroOutACC not ax jmp AAA :ZeroOutACC xor ax, ax ;; or just mov ax,0 :AAA etc etc It's been a while so I don't remember 8086 syntax that well
29th Sep 2018, 8:19 PM
Nestor
0
Nestor Thank you, that's it 👌🏻
30th Sep 2018, 8:33 AM
BraveHornet
BraveHornet - avatar