flat assembler
Message board for the users of flat assembler.

Index > Main > Jump Above or Equal, or Jump Carry Clear.

Author
Thread Post new topic Reply to topic
SoLo2



Joined: 09 Mar 2007
Posts: 14
SoLo2 26 Aug 2007, 05:32
I am using 1 Byte in AL to
count from 244 to 0 included.
This means that I have to check
for zero or above to repeat
the loop, or carry clear, as I
think that carry would happen
when turning from 0 to -1 (255),
right?


Well... I tried a little routine like
this in fasm, but it never ends:

mov al,244
loop0:
call ClearFMRegister
dec al
jcc loop0

FYI, this is supposed to clear
registers of the FM synth of
soundblaster/adlib cards
(which I don't manage too sound)

Greetings,
so_o2
Post 26 Aug 2007, 05:32
View user's profile Send private message Visit poster's website Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 26 Aug 2007, 06:19
1. carry jump is 'jc' or 'jnc' not 'jcc'.
2. dec doesn't change the carry flag. You should use 'sub reg,1' for that.
3. if you want to use 'dec' use 'jnz'. And don't forget to save 'eax' in 'ClearFMRegister'. Also, keep in mind that j(n)z will jump on zero (0) condition while j(n)c will jump on carry condition (255 / -1), so there's a difference of 1 between the two.
Post 26 Aug 2007, 06:19
View user's profile Send private message Reply with quote
SoLo2



Joined: 09 Mar 2007
Posts: 14
SoLo2 26 Aug 2007, 07:05
Thanks ManOfSteel!

I will be using "sub reg,1" then.
And, of course, it was "jnc" and not "jcc".

Greetings,
SoLo2
Post 26 Aug 2007, 07:05
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.