[A83] Re: What the heck is RST???


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

[A83] Re: What the heck is RST???




To give some more information, the code at 0028h (though I think it contains
a jump to another rom area)
reads the address to call from the stack, much like this code:

pop ix      ;get the address to retrieve info from
ld h,(ix+0) ;retrieve the adrress to call to
ld l,(ix+1) ;
inc ix ; increase the address this routine should return to by 2,
inc ix ; to account for the address data
push ix ; push it back

out pointerpage,(memswap_port) ;load the correct pointerpage
push hl ;to store hl
call real_call ;
ret
real_call:     ;to be able to return, with 'ret' after the code is executed 
jp (hl)


I think though that the real code is very different, but this 
gives a general idea, the real code also remembers the rompage you are on
when you call it

--Peter-Martijn



> 
> 
> >From: "Nick Reichert" <discjammer@hotmail.com>
> >
> >Hello,
> >Can anyone tell me what "rst" does? It is part
> >of the definition for B_CALL(#define B_CALL(xxxx)
> >rst 28 // .dw xxxx or something like that), and
> >it may give a little boost in speed. All I know
> >is that it stands for restart, and "rst xxxx" is
> >similar to "call xxxx", but what is the difference
> >or advantage?
> 
> "rst xx" is, as you said, the same as a call, but it's only one byte in size 
> and (most importantly) it only works on some predefined addresses: 0000h, 
> 0008h, 0010h, 0018h, 0020h, 0028h, 0030h, 0038h.
> The bcall macro is actually just a call to 0028h. The code at 28h then looks 
> up the address defined after the rst and then calls the appropriate rom 
> routines.
> 
> Tijl Coosemans
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> 
> 




References: