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


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

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




Ehm, I suppose I need to make my own _ldaindpaged routine, can someone give me a bit of advice?

My idea so far:
1 - Since it needs to be in ram, copy it to a memory location
    if it is neccesary (when writing an app).
2 - the routine needs to reload the appage from where it is called,
    so it needs to store that. "in a,(06h)"??
3 - it needs to load the rompage specified and the hl specified, no problem
5 - return to the right place and page for an app.

Code so far:
a: value of byte (output)
b: rompage to load (input)
hl: address to read from (input)

Thrashes:
c ; for speed issue

Code:

  ld c,06h   2Eh 06h
  ld a,b     78h
  in b,(c)   40h EDh
  out (c),a  79h EDh
  ld a,(hl)  7Eh
  out (c),b  41h EDh
  ret        C9h

total: 11 bytes, fits in... saferam4 (ops), 8478h (according to ion.inc)

Anyone a better idea? faster? smaller?

--Peter-Martijn Kuipers



> Yes -- or if you really want to use one of the calls which is on page 0 (ex:
> access to other ROM pages on 83+), get the call's pointer data, store it in
> memory somewhere following a jp opcode, and call to that location instead.
> 
> -----Original Message-----
> From: assembly-83-bounce@lists.ticalc.org
> [mailto:assembly-83-bounce@lists.ticalc.org]On Behalf Of Dan Weiss
> Sent: Saturday, July 07, 2001 11:17 AM
> To: assembly-83@lists.ticalc.org
> Subject: [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: References: