Re: A86: List problems


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

Re: A86: List problems




findsym (rst 10h) returns the 24 bit address in bde., _GETLTOOP1 wants it
in ade.
also, remember list elements are zero based.
what you want is this:

> ld hl, listname-1
> rst 20h
> rst 10h
  ld a,b
> ld hl,2            ;extract element 2 (3rd element)
> call _GETLTOOP1


hmm, it seems my pervious information about _insertlist was wrong...

_insertlist: add elemtents to a list
_PINSDELPTR = start of list (use _SET_INSDELPTR)
a = list type (bit 0 set for complex, clear for real, other bits ignored)
bc = index where elements are insterted
hl = number of elements to insert
carry set: fill new elements with 1
carry clear: fill new elements with 0
on return, ahl->start of list

if you only want to insert one item, use _INCLSTSIZE, then copy the
element in with _PUTTOL:

; insert one element at the end (new element = 0)
   ld hl,listname-1
   rst 20h
   rst 10h
   ex de,hl                ; _INCLSTSIZE wants list start in bhl
   ; a = list type from findsym
   call _INCLSTSIZE

   ; at this point ahl->start of list
   ; _P_INSDELPTR -> start of list as well

; set new element's value
   ; get index to store element
   call _GET_DATA_SIZE_DE_INC
   dec de
   push de

   ; get value to op1
   ld hl,value
   rst 20h

   ; get start of list to ade
   call _LOAD_INSDELPTR
   ex de,hl

   ; element number to hl
   pop hl
   call _PUTTOL


for multiple items, use _insertlist, then copy with _mm_ldir or a loop
with _PUTTOL.


-josh



On Mon, 5 Feb 2001 00:52:22 -0500 (EST) Jason Shirey
<shiwokarauotoko@juno.com> writes:
> 
> I'm having difficulty with a few of the list routines.
> In particular, both GETLTOOP1 and the act of appending an element to 
> a list are really throwing me a curve.
> To extract an element, I'm very clear on the protocol, I just can't 
> seem to get it to work:
> Here's my code
> -----
> As for appending a list, I'm still a bit unsure of whether to use 
> dimension-increasing-call then use _PUTTOL or to just use the 
> insert-element-call and insert the element at hl=dimension(list)+1
> Does anyone have some sample code I could study to answer these 
> questions?
> --JDS
> 
> 
> 
> 
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.