flat assembler
Message board for the users of flat assembler.

 Index > Main > rcl Sanity check Required
Author
Howesr1@yahoo.com

Joined: 28 Apr 2011
Posts: 13
Location: Las Vegas, NV
Howesr1@yahoo.com 13 May 2011, 18:55
I have a sanity check I need verified.

in FASM

I put 0xeb into al

mov al, 0xeb
rcl al,1

and the carry flag is NOT set.

In Visual Studio asm the carry flag gets set.

Does this make sense?

Can anyone verify how rcl works for me?

_________________
13 May 2011, 18:55
JohnFound

Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 13 May 2011, 20:35
Of course, CF=1 after executing your example. The code generated from the above instructions is: \$b0, \$eb (mov al, \$eb), \$d0, \$d0 (rcl al, 1)
The result logically is al=\$d6
Check your source and use FASM only. Too many use of C really can harm your sanity.
13 May 2011, 20:35
Howesr1@yahoo.com

Joined: 28 Apr 2011
Posts: 13
Location: Las Vegas, NV
Howesr1@yahoo.com 13 May 2011, 21:25
No c used here. I'm writing low level bios code and trying to print out the data while not stepping on it at the same time! Pushing and popping flags are interesting!

For some reason the code doesn't work

al - eb
rcl al,1
rcl bx,1

... Should rotate the carry flag from ax to bx and it does not do that!
The weird thing is when I print ax befoe th rcl al I get eb00 instead of 00eb

How does this: rcl al
affect all of ax?

_________________
13 May 2011, 21:25

Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
Code:
```;no problem here
;debugger : Syser

xor ebx,ebx
clc

;--------------------------

mov al,0xEB    ;result al  = 0xEB       - cy=0
rcl al,1     ;result al  = 0xD6       - cy=1
rcl bx,1     ;result ebx = 0x00000001 - cy=0
```

_________________
I am not young enough to know everything (Oscar Wilde)-

Last edited by ouadji on 13 May 2011, 22:42; edited 1 time in total
13 May 2011, 21:43
LocoDelAssembly

Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 13 May 2011, 22:22
To avoid the CLC you could use SHL the first time and RCL the second time.
13 May 2011, 22:22

Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

my goal was to test the code proposed by "Howesr1",
without change, and therefore without any optimization.
That said, I'm agree with you.

_________________
I am not young enough to know everything (Oscar Wilde)-
13 May 2011, 22:41
JohnFound

Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 14 May 2011, 05:09
Howesr1@yahoo.com, you better post some bigger part of your code. The problem is not in the particular instructions. What debugger you are using?
14 May 2011, 05:09
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum