Re: Fw: LZ: Re:


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

Re: Fw: LZ: Re:



>Yup, I've looked at both these files, but I'd like to know what Add with
>carry >means, or what happens when you AND or OR something, what the IX
>and IY >registers do...  that kind of stuff.  And I'd prefer not to have
>to purchase a >book :)  This info MUST be on the web somewhere, no?  You'd
>almost think it >should be on ticalc.org by now...  Just my random
>babblings.


Ok, And'ing is a boolean logic concept.  It works on true and false values.


true  'and' true  = true
false 'and' false = false
false 'and' true  = false
true  'and' false = false


Ok, so if you and'ed two bytes together, like 166 and 115...


     10100110
     01110011
and ---------
     00100010 you'll get 34, ok.


So if you say "AND 35", you've essentially said A = A & 35.


Or'ing is similar,


true  'or' true  = true
false 'or' false = false
false 'or' true  = true
true  'or' false = true


So lets or our two numbers 166, and 115


     10100110
     01110011
or  ---------
     11110111 you'll get 247, ok.
The beauty in this instruction is that you can "OR A" and if you or
something with it self, the value doesn't change, but it does cause the
Zero flag to be updated.  You can use this to determine if the value of
something has changed.


LD A, B
OR A
JUMP_NZ(B_Has_Changed)
Or the most used way, the get key loop.


GetLoop:
     CALL GET_KEY
     OR   A
     JR   z, GetLoop
     RET


Ok, the IX, and IY registers are called the index registers.  These allow
you to use known offsets to load data into other registers.  Here...


LD IX, String ;get the address of 'string'
LD A, (IX+2)  ;will fill A with 5.


String:
     .db 1,3,5,7,9


You can also use this to write saved data into memory.  You would just say
"LD (IX+3), A" which would put the value of A where the '7' is.


I hope this helps you to understand these concepts, and if anybody sees a
typo that I have made, post a correction.


                                             -C.J.-






********************************************************************
Unsolicited commercial e-mail to the poster of this message
will be proofread at $70/hr, minimum charge $150.  Submission
of such e-mail to this address will suffice as contractual assent
to the said charging schedule.
********************************************************************


 


References: