Re: A85: 16 bit registers...


[Prev][Next][Index][Thread]

Re: A85: 16 bit registers...




if i am not mistaken, "sbc" sets the flag register and works with 16 bit
registers.

so you would do:

 or a                ;clear the carry flag (needed for "sbc" instr.)
 ld de,1            ; if you want to subtract 1
 sbc hl,de        ;set flags and dec hl by de
 jr z,?????

or a different (possibly more effiecient way):

 scf                ; set the carry flag
 sbc hl,de        ; de must be 0!
 jr z,?????

i think both of those work.

-mike pearce

-----Original Message-----
From: The Boots of Enlightment <ehuizing@ucalgary.ca>
To: assembly-85@lists.ticalc.org <assembly-85@lists.ticalc.org>
Date: Tuesday, December 29, 1998 7:02 PM
Subject: Re: A85: 16 bit registers...


>
>
>Here's probably the quickest, smallest way to do this:
>
>loop:
>; loop stuff here
>dec bc
>ld a, b
>or c
>jr nz, loop
>
>On Tue, 29 Dec 1998, Michael Turitzin wrote:
>
>>
>>
>> I'm VERY new(about 2 days) to ti-85 assembly code, so excuse this newbie
>> question.  I'm trying to check if a 16 bit register( bc ) is 0, but I
can't
>> find a way to do it other than checking b and then c for 0 values.  "dec"
>> seems to only set z if the register is 8 bit, and most everything else I
can
>> find that sets this value uses A and needs an 8 bit register as the
>> "parameter".  This is the code I am currently using:
>>
>>  dec      bc
>>  ld       a, 0
>>  cp       b
>>  jr       nz, FlashLoop
>>  cp       c
>>  jr       nz, FlashLoop
>>  jr       MainLoop
>>
>> Is there a better way of checking for a zero value in bc?
>>
>> MaNiAc
>>
>>
>
> from the Dark Side of the Moon...
>               /\       ________________
>   -----------/  \======================
>              /____\     ----------------
>   Erik Huizing
>   ehuizing@ucalgary.ca
>   http://www.ucalgary.ca/~ehuizing
>
>