Re: A85: DJNZ


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

Re: A85: DJNZ




> From listown@towerguard.unix.edu.sollentuna.se Mon Jul 28 16:27:19 1997
> Date: Mon, 28 Jul 1997 14:39:22 -0500
> From: John Koch <john@imagin.net>
> Organization: ImagiNet Communications, Lmt. Customer
> X-Mailer: Mozilla 3.01GoldC-KIT  (Win95; I)
> Mime-Version: 1.0
> To: assembly-85@lists.ticalc.org
> Subject: Re: A85: DJNZ
> Content-Type> : > text/plain> ; > charset=us-ascii> 
> Content-Transfer-Encoding: 7bit
> Sender: owner-assembly-85@lists.ticalc.org
> Reply-To: assembly-85@lists.ticalc.org
> Content-Length: 2041
> 
> What I'm doing is I have a gameboard.  each box is 6 pixels X 6 pixels.
> So a total of 36 pixels I want to change.  Here is what I have
> 
> Flip_Box:
> 	push bc
> 	ld b,6
> 	push bc
> Outer:
> 	ld b,6
> Inner:
> 	pop bc
> 	pop bc
> 	CALL_(PtChg)
> 	push bc
> 	puch bc
> 	djnz Inner
> 	djnz Outer
> 	ret
> 
> And that like gives me two lines all the way across my screen.  What is
> happening?
> 
> Thanks
> John
> 
> Will Stokes wrote:
> > 
> > while it may seem I'm experienced (or somewhat :) in asm I've never seen a
> > book on how to program in asm, let alone z80 asm. all this stuff (ld,
> > call, cp, ret, djnx, ldir, ex, etc.) I've learned from here-say. :( I
> > tried to get the books from zilog but they were hopeless. If anybody could
> > tell me how to get such books I'd love it. how? I tried off their website
> > but I've never gotten anything through it. I need all the z80 information
> > I can get from them. since other people have gotten the book, could they
> > tell me how to get them , or order them in my name for me?? =) Thanx a
> > ton!
> > 
> >                                 Biya! =)
> > 
> >                          .       .     .
> >                      .    .   .             .
> >               .    .                            .     .
> >           .                     Will Stokes                .
> >       .             wstokes@vertex.ucls.uchicago.edu           .
> >     .                   wstokes@geocities.com                       .
> >       .  http://www.geocities.com/SiliconValley/Pines/7360/will.htm    .
> >        .                                                             .
> >       .                                                               .
> >        .   http://www.geocities.com/SiliconValley/Pines/7360/      .
> >         .    .           (The TI-85 Calc. Center)               .
> >           .                                                      .
> >                .               .                     .       .
> >                   .         .    .       .    .    .   .   .
> >                      .   .          .   .       .       .
> >                        .
> 
Well, for one thing, you're pushing BC twice on the stack before you return.  Well actually you never will.  Because the PC will have what BC was when it was pushed onto the stack.  RET pops what is on the stack (generally the address that was pushed onto the stack when you did a CALL) into the PC.  However, the return address will not go into the PC,  BC will instead, meaning it will try to return to whatever BC held when it was push onto the stack.