Re: A83: User selected list


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

Re: A83: User selected list




If I don't inc bc, then this code skips the last list item:

;------------------------------->Compare items to user number
;------------------------------->op2 = compare to, item count in 
VAR_COUNTUSE
	ld	a,(VAR_COUNTUSE);get useable count into b
	ld	b,a
	ld	hl,(VAR_STARTLIST);get list back
	inc	hl		;skip past length of list (we got that!)
	inc	hl
COMPAREITEMS:
	push	bc
	push	hl
	rst	20h		;calls _MOV9TOOP1 (copy from hl into op1
	call	_cpop1op2	;musn't kill bc (count) or hl (ptr to items)
	pop	hl
	pop	bc
	call	c,ADDBELOW
	call	z,ADDEQUAL	;return is easier here
	djnz	COMPAREITEMS	;ok, this only works with b, not bc
	jr	CALCPRCNTL      ;this is a true lable later

ADDBELOW:			;TODO:	find out what flags are affacted!
	ld	de,(VAR_BELOW)
	inc	de
	ld	(VAR_BELOW),de
	ret
ADDEQUAL:
	ld	de,(VAR_EQUAL)
	inc	de
	ld	(VAR_EQUAL),de
	ret

BTW, is this code sound?  It seams a little buggy to me.  Thanks again.

>From owner-assembly-83-outgoing@towerguard.unix.edu.sollentuna.se Sun 
Oct 18 14:43:42 1998
>Delivered-To: assembly-83-outgoing@towerguard.unix.edu.sollentuna.se
>Received: by towerguard.unix.edu.sollentuna.se (VMailer, from userid 
507)
>	id 4415AC4864; Sun, 18 Oct 1998 23:43:29 +0200 (CEST)
>From: Linus Akesson <lairfight@softhome.net>
>To: Henry Davidowich <assembly-83@lists.ticalc.org>
>Date: Sun, 18 Oct 1998 23:37:30 +0100
>Message-ID: <yam7595.1540.275021624@smtp.softhome.net>
>In-Reply-To: <19981018192456.29721.qmail@hotmail.com>
>X-Mailer: YAM 1.3.5 [020] - Amiga Mailer by Marcel Beck
>Subject: Re: A83: User selected list
>MIME-Version: 1.0
>Content-Type: text/plain
>Sender: owner-assembly-83@lists.ticalc.org
>Precedence: list
>Reply-To: assembly-83@lists.ticalc.org
>Errors-To: assembly-83-errors@lists.ticalc.org
>
>
>Hmm, that code seems ok. You don't need to inc bc, however.
>
>Linus
>
>On 18-Oct-98, Henry Davidowich wrote:
>
>>Linus, VAR_STARTLIST is sound.  I stored from de it right after 
calling 
>>_chkfindsym.  Take a look.
>
>
>
>>;------------------------------->Get a user selected list
>>call_userChooseList;user picks a list (my function)
>>call_chkfindsym;look up list
>>jpc,_errundefined;no list! quit!
>>ld(VAR_STARTLIST),de;store this for later
>>call_newLine;does this kill hl?
>
>>;------------------------------->get list size into VAR_COUNTUSE, hl = 
>>1st item of list
>>;------------------------------->also check dimensions of list (less 
>>than 256, more than 1)
>>ldhl,(VAR_STARTLIST);get the list back
>>ldc,(hl)
>>inchl
>>ldb,(hl)
>>inchl
>>ld(VAR_COUNT),bc;store this for later
>
>>incbc;this needs to be 1 larger for djnz use?
>
>>lda,b;acc = high byte of size
>>ora;compare high byte to 0
>>jpnz,_erroverflow;too big
>
>>lda,c;compare low byte to 0
>>ora
>>jpz,_errdimension;too small
>
>>lda,c;store useable count
>>ld(VAR_COUNTUSE),a
>
>
>>______________________________________________________
>>Get Your Private, Free Email at http://www.hotmail.com
>
>
>


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com