flat assembler
Message board for the users of flat assembler.

Index > Main > rcl Sanity check Required

Author
Thread Post new topic Reply to topic
Howesr1@yahoo.com



Joined: 28 Apr 2011
Posts: 13
Location: Las Vegas, NV
Howesr1@yahoo.com
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?

your help is appreciated!

_________________
Bob's your uncle. Millie's your aunt.
Post 13 May 2011, 18:55
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
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. Razz
Post 13 May 2011, 20:35
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Howesr1@yahoo.com



Joined: 28 Apr 2011
Posts: 13
Location: Las Vegas, NV
Howesr1@yahoo.com
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?

_________________
Bob's your uncle. Millie's your aunt.
Post 13 May 2011, 21:25
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji
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)- Image


Last edited by ouadji on 13 May 2011, 22:42; edited 1 time in total
Post 13 May 2011, 21:43
View user's profile Send private message Send e-mail Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
To avoid the CLC you could use SHL the first time and RCL the second time.
Post 13 May 2011, 22:22
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

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)- Image
Post 13 May 2011, 22:41
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
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?
Post 14 May 2011, 05:09
View user's profile Send private message Visit poster's website ICQ Number 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-2020, Tomasz Grysztar.

Powered by rwasa.