[A83] Re: TIOS BASIC parser (83-)


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

[A83] Re: TIOS BASIC parser (83-)




The following code will point HL to the last interpreted byte, which is the
last character in the program name. So in your example the 'B' in PROGRAM:A.

  call  _popReal01        ; pop program name from FPS
  rst   18h               ; push program name again
  call  _findProgSym      ; get program location
  inc   de                ; skip size bytes
  inc   de                ;
  ld    hl,(9311h)        ; get pointer to operator stack
  ld    bc,6              ; add 6 to get cursor offset
  add   hl,bc             ;
  call  _ldHLind          ; get cursor offset
  add   hl,de             ; add cursor offset to program location

Point is: an absolute pointer isn't saved, simply because a program's
location might change. So, when running a program from another program, the
TIOS saves an offset. That offset is saved in what is called the operator
stack. The TIOS saves some other pointers and values on this stack, which
are rom specific. Anyway, by adding 6 to the OPSP(ointer) (=9311h), and
loading the word at that address, you have the offset. Add that to the
program location and you have the last interpreted byte.

----- Original Message -----
From: "Henk Poley" <HPoley@DDS.nl>
To: <assembly-83@lists.ticalc.org>
Sent: Monday, November 26, 2001 20:39
Subject: [A83] TIOS BASIC parser (83-)


>
> Does somebody know where the TIOS stores the pointers/cursor of the before
> last running BASIC program? Given this example:
>
> PROGRAM:A
> :prgmB
> :"SOME TEXT
>
> PROGRAM:B
> :send(9prgmASM
> :"BLAH BLAH
>
> I can lookup that the previous BASIC program was prgmB ($913B), where
prgmB
> was left off ($9146), and I can see that prgmA started prgmB (call
> _popRealO1). But now I want to know where it left prgmA. The TIOS does
> store it somewhere, but why can't I find it?
>
> Henk Poley <><
>





References: