[A83] Re: Conditional bcall()ing


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

[A83] Re: Conditional bcall()ing





----------------------------------------------
Original Message
From: "Tijl Coosemans"<tijl.coosemans@mail.be>
Subject: [A83] Re: Conditional bcall()ing
Date: Mon, 29 Oct 2001 21:45:34 +0100

>
>> From: Tijl Coosemans <tijl.coosemans@mail.be>
>> 
>> > From: Emir Sakic <saka@hotmail.com>
>> > 
>> > Right, my fault about lables.
>> > jr 3 gave me error with $9327 as start address, thanx for clearing it.
>> > 
>> > Anyway to conclude:
>> > #define bcall_z(addr) jr nz,$+5 \ rst 28h \ .dw addr
>> > :)
>
>> indeed, as taken from the Ion.inc file
>> 
>> #define bcall(xxxx)	rst 28h \ .dw xxxx
>> #define bcallz(xxxx)	jr nz,$+5 \ rst 28h \ .dw xxxx
>> #define bcallnz(xxxx)	jr z,$+5 \ rst 28h \ .dw xxxx
>> #define bcallc(xxxx)	jr nc,$+5 \ rst 28h \ .dw xxxx
>> #define bcallnc(xxxx)	jr c,$+5 \ rst 28h \ .dw xxxx
>> 
>> I think somebody has already sent this, but since I didn't remember... :)
>
>BTW: Even though it's a byte bigger, a 'jp' would be faster than a 'jr'.
(Not that the gain in speed 
>is very large compared to a 'bcall'.)

Yes, but the problem with that is that if you use a jp instead of a jr the
jump would NOT be relative, and you could NOT use the #define statement to
make the whole bcall_z(xxxx) thing.  Why?  Simple - you would need a label
right after the bcall to jump to if nonzero is set.  And if you used the
"#define jp nz, label \ rst 28h \ .dw xxxx", you would always jump to
"label" =p not good.  You <i>could</i> just not use #define and write in
    jp nz, label
    bcall(xxxx)
    label
each time you want to do bcallz(xxxx), but that would defeat the point of
the whole #define thing =)
>-----------------------------------------------------
>Mail.be, Free WebMail and Virtual Office
>http://www.mail.be
>
>
>
>

_____________________________________________
Free email with personality! Over 200 domains!
http://www.MyOwnEmail.com