Re: A83: Tell me if..
[Prev][Next][Index][Thread]
Re: A83: Tell me if..
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!
>
>
>
References: