Re: A83: Tell me if..
[Prev][Next][Index][Thread]
Re: A83: Tell me if..
Hey,
And, in addition to what he said, the cp 0 is not needed because ld are
not case commands such as jp nz, Start. It would more of a if-else
situation.
>Date: Wed, 22 Jul 1998 23:14:41 +0100
>To: assembly-83@lists.ticalc.org
>From: Olle Hedman <oh@hem.passagen.se>
>Subject: Re: A83: Tell me if..
>In-Reply-To: <199807222206.SAA25627@n01132-lau1.unity.ncsu.edu>
>Mime-Version: 1.0
>Content-Type: text/plain; charset="us-ascii"
>Sender: owner-assembly-83@lists.ticalc.org
>Precedence: list
>Reply-To: assembly-83@lists.ticalc.org
>Errors-To: assembly-83-errors@lists.ticalc.org
>
>
>I think you have mixed platforms together here :)
>cp does not work such as it skips the next instruction when true..
>that is on small RISC systems like the Pic16C84...
>
>the cp on the z80 is equal to a sub, but it does not change the
contents of
>A..
>it just sets the flags according to the result..
>so your program will just loop around in that first loop as you
stated..
>and the four last instructions will never be caried out..
>
>but if they would be, then all of them whould carried out.
>
>you must remember.. programming ASM is very different from any high
level
>language..
>
>you have to jump around.. because that is exactly what your program
would
>do at the end, when you do a case or if-statement in a high level
>language.. I think that is what you want..
>
>//Olle
>
>At 18:06 1998-07-22 -0400, you wrote:
>>
>>Let's say I have this bit of code:
>>
>>Start:
>> ld a,0
>> cp 1
>> jr nz,Start
>> cp 0
>> ld a,4
>> ld b,6
>> ret
>>
>>.................
>>
>>of course, this will result in a program that never returns to normal,
so
>>it will involve pulling batteries, etc.. (see, I'm too stupid to make
>>Calcem work, I can't even dump a rom correctly), anyhow.. those last 4
>>lines:
>>
>>cp 0
>>ld a,4
>>ld b,6
>>ret
>>
>>Will the ld commands both be executed if a=0, or just the one under cp
0 ?
>>That's what I want to know! If not, is there a way to group commands
>>under one cp condition, without having to put a jr under it to jump to
>>an entirely different foreign label, which confuses me, and pisses me
>>off..... well, anyways.. If you can figure this one out, thanks!
>>
>>
>>
>
.-"""-.
/ .===. \
\/ 6 6 \/
( \___/ )
_______________ooo__\_____/____________________
/ \
| Revenant revenant_1@hotmail.com ICQ#3608935 |
| VISIT THE JAVASCRIPT REFERENCE |
| http://www.geocities.com/~homosapian/ |
\_____________________________ooo_______________/
| | |
|_ | _|
| | |
|__|__|
/-'Y'-\
(__/ \__)
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com