flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > DOS > [BL vs BX] rol instruction not cycling?

Author
Thread Post new topic Reply to topic
theguy



Joined: 22 Jan 2015
Posts: 10
[BL vs BX] rol instruction not cycling?
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: 15096
Location: The Unicomplex
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
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: 15096
Location: The Unicomplex
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.