Re: A82: Re: Question...


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

Re: A82: Re: Question...




The BIT instruction which is the one which needs to be fast takes 12 T
states if you use HL, and 20 T states if you use IX (and it is 2 bytes
longer). If Hl is needed for sometihng else you would need to do the
following PUSH HL \ LD HL,nn \ POP HL (10 T + 11 T + 10 T) which takes
longer time than using IX.

I mentioned both posibilities because which one you should chose depends
on which registers you are currently using. 

Dines

BTW BIT b,(IY+$xx) takes long time to, but no one uses BIT b,(HL)
-----Original Message-----
From: Robert Bonstein <bonstein@mindspring.com>
To: assembly-82@lists.ticalc.org <assembly-82@lists.ticalc.org>
Date: 7. marts 1998 21:14
Subject: Re: A82: Re: Question...


>
> IX would work, but if you are looking for optimization, loading the
index
>register isn't the way to go.  Loading anything to IX takes 4 bytes and
20
>ticks, and SET and RES are both 4 bytes/23 ticks (when using the index
>register).  Your HL suggestion is better, the instructions take up half
of
>the space.
> Rob
>
>At 07:53 PM 3/6/98 +0100, you wrote:
>>
>>Just declare the var as:
>>RowVar:
>>.DB 0 ; define 8 bits
>>Then load IX with a pointer to the var:
>>LD IX,RowVar
>>Then you can just use RES b,(IX+$0) and SET b,(IX+$0) to reset/set bits
>>(just replace b with the number of the bit). Instead of using IX you can
>>use HL too, just do something like this
>>
>>  LD HL,RowVar ; Point to the vars
>>  SET 1,(HL) ; Bit 1 = 1
>>  RES 2,(HL) ; Bit 2 = 0
>>
>>DInes
>>-----Original Message-----
>>From: A. El-Helw <ahmedre@worldnet.att.net>
>>To: assembly-82@lists.ticalc.org <assembly-82@lists.ticalc.org>
>>Date: 5. marts 1998 22:19
>>Subject: A82: Question...
>>
>>
>>>
>>>Hello Everyone,
>>> I am going to start a new project [actually, I have already :]  and I
>>have
>>>a question... suppose I wanted to store 8 numbers [either 1 or 0] in a
>>>variable.. could I do this?  I think you can do it with bits and bytes
>>but
>>>I don't know how really :P  Is this possible, or could someone show me
an
>>>easier way??
>>>
>>>RowVar: .db 0,0,0,0,0,0,0,0
>>>
>>>ld hl,1
>>>ld (RowVar),hl ;Load? all of RomVar Numbers as 1????
>>>
>>>ld hl,0
>>>ld (RomVar+8),hl ;Load? 0 into RomVar+8 [the 8th #???]
>>>
>>>ld hl,(RomVar+7) ;Load ??? The seventh number into hl?
>>>
>>> 
>>>Ok, so hopefully someone will understand what I am trying to ask :P
>>Thanks...
>>>
>>> -Ahmed
>>>Ahmed El-Helw
>>>ahmedre@worldnet.att.net
>>>http://asm86.home.ml.org
>>>http://asm8x.home.ml.org
>>>Ahmed_ on IRC
>>>ICQ UIN: 3350394
>>>
>>
>>_______________________________________
>>
>>Dines Justesen
>>Email: dines@post1.com or
>>       c958362@student.dtu.dk
>>WWW  : http://www.gbar.dtu.dk/~c958362/
>>_______________________________________
>>
>>
>


_______________________________________

Dines Justesen
Email: dines@post1.com or
       c958362@student.dtu.dk
WWW  : http://www.gbar.dtu.dk/~c958362/
_______________________________________