Re: A86: parsing? home screen entries


[Prev][Index][Thread]

Re: A86: parsing? home screen entries




there's no call to create a temp prog var, but equ should work
this will copy an entry to a temp var: (it's kinda short...)
	ld a,entry #			; this code won't work for a=0
	ld (_curlastentry),a
	call _GETLASTENTRY		; get ptr to history entry
	ex de,hl
	push hl			; save addr
	ld e,(hl)			; get size of entry
	inc hl
	ld d,(hl)
	ex de,hl			; to hl to create var
	inc hl				; add space for size word
	inc hl
	push hl			; save size
	call _CREATETEQU
	ld hl,(_OP1+3)		; save temp var name
	ld (savename),hl
	call _SET_ABS_DEST_ADDR	; copy to here
	pop hl				; get size back
	xor a
	call _SET_MM_NUM_BYTES	; number of bytes to copy
	pop hl				; get source addr back
	call _SET_ABS_SRC_ADDR	; copy from here
	call _mm_ldir			; copy

then use _detok (see below) to detokenize it.  you may need to reload the
temp var name to op1:
	ld hl,$2403			; 3,"$"
	ld (_OP1+1),hl
	ld hl,(savename)
	ld (_OP1+3),hl

now you can either modify the equ var in place, or copy it out, change
it, and copy it back
i don't remember the exact details of using _COMPILE, but i think it's
fairly simple
when you want to copy the entry back, you can use _GETLASTENTRY again to
find where to put it but you have to move all the entries after it,
possibly decrementing _numlastentries, to adjust for any size difference
also, i think the os will delete temp vars for you when you return from
your program, but it might be a good idea to delete each one when you're
done to make sure you don't run out of space

_GETLASTENTRY                    equ            4627h
_detok                           equ            51D9h
_COMPILE                         equ            51E5h

_GETLASTENTRY - get pointer to homescreen history entry
  input:
    (_curlastentry) = entry number; 0 to (_numlastentries)
  output:
    bde -> entry size word
    a = 0
    hl destroyed
    (_curlastentry) is incremented or reset

this will fail if (_curlastentry) > (_numlastenties), but not if they are
=
entry number 0 is the '#' variable
each history entry is
 word length of entry (excl. this word)
 ascii string tokenized entry
you probly shouldn't modify entry 0, as it's the one currently being
executed and you might cause the os to lose track of what it's doing. 
(unless you fix all the pointers, but you don't want to do that)

_detok - decompile basic program
this doesn't complete the process, and you need to open & close the prog
editor.  here's how to do all of that:
;; load varname to op1 first
    call _setupEditEqu		; open prog in editor
    call _detok			; detokenize
    call _bufToTop		; go to the top
    xor a			; insert $00 at the top
    call _bufInsert		; to mark it as uncompiled
    call _closeEditEqu		; close prog editor

_COMPILE - compile basic program or equation
  input:
    var name in op1
    pointer to var size word in ahl
  output:
    program name in op1, op3
    all registers modified
    sets up and closes equation editor vars

-josh

On Sun, 27 Feb 2000 09:41:58 EST TI86Z80@aol.com writes:
> 
> Thanks very much for your help so far. I still have a few questions, 
> 
> hopefully somebody will be able to answer them.
> 
> rabidcow@juno.com:
> >>"the best way to deal with the entries is to leave them in 
> tokenized form
> >>and simply modify that.  if you can't do that, you'll have to copy 
> them
> >>into a temporary variable and use _detok."
> 
> Since I don't want to leave them in tokenized form I was wondering 
> if someone 
> could give me a short code example of how to copy a previous entry 
> to a temp 
> variable. (how to I find the previous entry in ram, etc...) I was 
> also 
> wondering how the _detok ROM call works. (what registers it needs 
> past, 
> etc...) And lastly I was wondering what the ROM call was to 
> recomplie/tokenize the modified string.
> 
> Thank everybody for all their help. (especially rabidcow@juno.com) 
> :)
> 
> Andy
> 

________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.