Re: A86: adding entries


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

Re: A86: adding entries




get the last entry's size & location.
add the amount of space taken by the new entry
subtract one from _numlastentries if the last entry won't fit anymore.
move _lastentrystk and all the entries you're going to keep up by the
size of the new entry.
copy the new entry, including size word, to _lastentrystk.
add one to _numlastentries.  (or combine this with the subtraction step
above)
set _currlastentry to zero. (semi-optional)

;; get size of new entry to de first (incl size word)
;; and save addr of size word to _ABS_SRC_ADDR

	ld a,(_numlastentries)
	dec a					; last entry #
	push de
	call _GETLASTENTRYPTR		; get entry
	ex de,hl
	ld e,(hl)
	inc hl
	ld d,(hl)
	inc hl
	add hl,de				; end of last entry
	pop de
	add hl,de				; end of last entry after insert
	push de
	ld de,_numlastentries		; end of _LASTENTRYSTK
	call _cp_hl_de			; will it fit?
	jr c,remove_last_entry
	ld a,(_numlastentries)		; yeah, inc entry count
	inc a					; otherwise remove&add one entry; no change
	ld (_numlastentries),a
remove_last_entry:
	pop bc
	push bc
	ld hl,_numlastentries-1		; destination
	ld d,h
	ld e,l
	xor a					; zero a & clear carry
	sbc hl,bc				; source
	ld bc,_numlastentries-_LASTENTRYSTK
	lddr					; moves more than you need...
	call _SET_ABS_DEST_ADDR		; copy new entry in
	pop hl					; get length of new entry
	ld (_currlastentry),a
	call _ABS_MOVE			; move ahl bytes

or something like that
i don't think there's any other ptrs to change

-josh

On Sat, 1 Apr 2000 12:29:00 EST TI86Z80@aol.com writes:
> 
> How can I add a home screen entry from an asm program. (Thanks to 
> rabidcow) I 
> understand how to use _compile to convert the ASCII and I also know 
> how to 
> use _GETLASTENTRY to figure out where the start of the data should 
> be copied 
> to. I am having problems figuring out how to move the other data and 
> how to 
> fix any pointers that would need to be adjusted.
> 
> Thanks for any help!
> 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.