Re: LZ: ZSHELL


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

Re: LZ: ZSHELL



On Mon, 09 Dec 1996 12:00:54 -0700,
Nathan Adams wrote...
>I learned Z80 assembly for zshell the way you have been trying to.  I
>downloaded all the text files on zshell programming I could find.  The 
best
>way to learn, I think, is to read all that you can find and to practice by
>writing simple programs.  Every time I start a new project I learn a lot 
of
>new things about assembly and zshell. A few things I still haven't figured
>out are what or and xor do and what carry is.  So if anybody wants to
>enlighten me as to their uses I'd be greatful.  I started assembly for
>zshell only a few weeks ago and right now I'm writing simple text editor 
as
>practice.  Although it's turning out to be not so simple.  Anyway, a good
>place to start is the TI-85 programming tutorial at
>http://www.best.com/~jparker/ti-asm.html and the text files and links at
>ticalc.org.

About the or and xor command; if you or a number (the or command needs an 
input in the acc), the value returned in the acc will have any bits set in 
the same place as any bits in either the previous acc or the number you 
or'ed it by.  Say the acc is %00001111 and you enter the command or 
%11110000, the result will be %11111111 (because in the acc, bits 0-3 were 
set, and in the number the acc is or'ed by, the bits 4-7 were set)

xor'ing will do something similar, but not quite.  If any bits in both the 
acc or the number you or'ed it by (From now on I'll just call it V!) are 
the same (set or unset), then they won't be set in the final result (stored 
in the acc).  Any bits where they are not the same, (i.e. one is set, the 
other isn't) the result will have a bit set in that place.  So if the acc 
holds the value %00001111, and you xor %11111111, the end result will be 
%11110000.  This is good for encoding parts of programs (such as passwords 
and stuff like that).

The carry bit is pretty simple.  Any addition during which the result is 
over 255, the carry bit is set to show that a number was carried over (to 
the carry bit).  It is also used in some shifting and rotation stuff.

I'd recommend the book "Programming the Z80," by Rodnay Zaks.  It's a great 
book for learning the basics of assembly language, and it's specific to the 
Z80.  It describes all of the commands that you may have questions about.

Michael Wyman - SeaHorse Software
wyma0012@gold.tc.umn.edu