flat assembler
Message board for the users of flat assembler.

Index > DOS > [BL vs BX] rol instruction not cycling?

Author
Thread Post new topic Reply to topic
theguy



Joined: 22 Jan 2015
Posts: 10
theguy 26 Jan 2015, 14:29
At no surprise i'm stumped again.

First here's code that iv'e tried that works as expected.

Code:
ORG   100h


 mov     bx,00000001b
 rol     bx,2
 mov     dl,bl
 add     dl,'0'    ; sets it up with the ascii to equal 4

 mov     ah,02h
 int     21h       ; display 4 in console

 mov ah,08
 int 21h           ; readkey
 int 20h 
    


But if i try something like this

Code:
ORG   100h


 mov     bx,10000000b
 rol     bx,2
 mov     dl,bl
 add     dl,'0'    ; sets it up with the ascii to equal 2

 mov     ah,02h
 int     21h       ; display 2 in console, but i end up with 0 instead

 mov ah,08
 int 21h           ; readkey
 int 20h 
    


I end up with 0 which is not what i expected, i thought it was going to be 2.
Post 26 Jan 2015, 14:29
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20343
Location: In your JS exploiting you and your system
revolution 26 Jan 2015, 14:38
bx is a 16-bit register so the bit is 'rol'ed into the high byte. Perhaps you want to use "rol bl,2"?
Post 26 Jan 2015, 14:38
View user's profile Send private message Visit poster's website Reply with quote
theguy



Joined: 22 Jan 2015
Posts: 10
theguy 26 Jan 2015, 14:41
Darn im an idiot, can't believe i didn't see that, thanks for your help sorry about wasting your time.
Post 26 Jan 2015, 14:41
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20343
Location: In your JS exploiting you and your system
revolution 26 Jan 2015, 14:44
Anytime we learn something is not a waste of time.
Post 26 Jan 2015, 14:44
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.