[A83] Re: What the heck is RST???
[Prev][Next][Index][Thread]
[A83] Re: What the heck is RST???
Disassembly of BCALL: (hope TI doesn't sue me)
0028:
jp 284c
284C:
push hl
push hl
push hl
push af
push bc
push de
push hl
ld hl,$000F
add hl,sp
ld d,(hl)
dec hl
ld e,(hl)
inc de
inc de
ld (hl),e
inc hl
ld (hl),d
in a,($06)
ld c,a
dec hl
dec hl
dec hl
ld (hl),a
dec hl
ld (hl),$29
dec hl
ld (hl),$23
dec de
ld a,(de)
ld h,a
dec de
ld a,(de)
ld l,a
ld b,$00
bit 7,h
jr nz,$2882
bit 6,h
jr z,$2888
res 6,h
ld a,$1B
jr $2893
2882:
res 7,h
ld a,$1F
jr $2893
2888:
in a,($06)
and $1F
ld de,$8230
add a,e
ld e,a
ld a,(de)
ld b,a
2893:
out ($06),a
ld de,_ldhlind
add hl,de
ld e,l
ld d,h
ld hl,$0008
add hl,sp
inc de
inc hl
ld a,(de)
ld (hl),a
inc de
ld a,b
or a
jr z,$28B0
ld a,(de)
neg
ld a,b
jr $28B5
28B0:
ld a,(de)
or a
jr nz,$28B5
ld a,c
28B5:
out ($06),a
pop hl
pop de
pop bc
pop af
ret
;113 bytes, 646 cycles
This code plainly tells why to avoid romcalls whenever necessary... make
your own routines instead! (ESPECIALLY LD_HL_MHL!)
>From: Hyperbyte <hyper@hysoft-automation.com>
>Reply-To: assembly-83@lists.ticalc.org
>To: assembly-83@lists.ticalc.org
>Subject: [A83] Re: What the heck is RST???
>Date: Sat, 7 Jul 2001 18:47:06 +0200 (CEST)
>
>
>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.
> >
> >
> >
>
>
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
Follow-Ups: