Re: LZ-Adv: Returning to Zshell from programs and checksums


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

Re: LZ-Adv: Returning to Zshell from programs and checksums



Mark and/or Esmeralda Lybrand wrote:
> 
> Howdy all!
> 
> First, let me again thank you for helping me out with my last spot of
> code.  I learned a valuable lesson about the difference between "call"
> and "CALL_()" (BTW: the first calls an address and the second calls a
> relative address.)  That did, of course make my CALL_(GET_KEY) jump
> somewhere scary.
> 
> I was working on some more code to look up values in the VAT.  I was
> having problems because my HL values were changing, so I pushed them.
> Then, I was able to scroll through memory at my leisure looking at the
> values there. But, when I tried to exit back to Zshell the calc crashed.
> I hacked away some more (not wanting to have you guys find all my bugs)
> and made and exit routine to pop HL back out before returning.  Now the
> code works fine.  However, this brings up my question:  What registers
> (such as HL) are used when returning to Zshell?  Or is there something
> else behind this problem?


Whenever you CALL_ or call somewhere the register PC, or program counter, 
is pushed onto the stack.  Zshell calls each program that you use, so if 
you push stuff onthe stack during the program, it gets screwed up on the 
return.  Actually, to make it easier, when the processor hits a RET, it 
loads PC ffrom the top of the stack and runs from there


> 
> One final question:  the compiler.85p program from Cliff Liang uses the
> equation: "sum B-FD and FF/_>/B(dimL B)"  to put the checksum into the
> 85s for Zshell.  I understand that this adds all the values of the
> program together, subtracts FD from them and then masks the value to get
> only the LSB portion of the value.  How was this formula arrived at and
> how does Z80/Zshell use this checksum?


Dont' know much about this, but...the checksum is used by the TI to 
transfer data correctly and make sure nothing gets screwed up.  For 
example, when you send data over the link, the checksum is used to make 
sure the data had a nice trip over the wire.  If not, the recieving calc 
tells the other to try to send it again.  This is just a small overview, 
wait until someone else says something better.


> 
> TIA
> 
> Mark. :)
> --
> 
> "No hay mal que por bien no venga"
>  - Spanish proverb
> 
> Mark and Esmeralda Lybrand
> 1330 West 10th Avenue #51
> Kennewick WA 99336-6070
> USA
> 
> Tel: (509) 586-1807


<pre>
-- 
Compliments of:
_-_-_-_-_-_-_-_
  Alan Bailey
  mailto:bailala@mw.sisna.com
  IRC:Abalone
  Web:http://www.mw.sisna.com/users/bailala/home.htm
</pre>


References: