[A83] Re: _insertmem
[Prev][Next][Index][Thread]
[A83] Re: _insertmem
So, let's say I'd load $9800 into de, and 100 into hl, the 100 bytes after
$9800 would be copied to $9327, the 100 bytes after $9800 won't be destroyed
and any information stored at $9327 (or the 100 bytes after that) will be
moved away? AM I CORRECT???
>From: "Henk Poley" <HPoley@DDS.nl>
>Reply-To: assembly-83@lists.ticalc.org
>To: <assembly-83@lists.ticalc.org>
>Subject: [A83] Re: _insertmem
>Date: Mon, 19 Nov 2001 13:23:54 +0100
>
>
> > Van: KWarp9@cs.com
> >
> > A few questions for the TI-83 (-).
> > I've been going through the source of Zasmload and I came across the
>romcall
> > _insertmem. Can anyone tell me what this does and how to use it?
> > I know that the name and size of a program are stored in the
>programtable
>and
> > at the actual place where the program is stored. Are there any other
>places I
> > should know about if I want to change anything in the name or size of
>the
>
> > program?
>
>For the Ti83 (source 83-rom.txt/zip):
>
>+- _INSERTMEM
>------+-------+-------+-------+-------+-------+-------+-------+
>| | 4432 | 4432 | 4432 | 4432 | 4432 | 4432 | 4432
>|
>+-------------------+-------+-------+-------+-------+-------+-------+-------
>+
>| Call to: | ???? | ???? | ???? | ???? | ???? | ???? | ????
>|
>+-------------------+-------+-------+-------+-------+-------+-------+-------
>+
>input: DE = place from where to allocate
> HL = size to be allocated
>output: DE = beginning of inserted memory
> VAT-pointers updated.
>destroyed: AF, HL, BC
>description: allocate one byte of memory,
>NOTE: First check if enough mem free (call _memchk) for allocated block!
> If you use this routine to enlarge a file, you have to manualy
>change
> the sizebytes of the file! (_insertmem doesn't do this)
>
>Enlarging a file is pretty straight forward, just lookup where the file is,
>pinpoint where you want to inserte free space, and update the sizebytes. As
>far as I know there is even a ROMcall that does right this (at least I've
>seen one on the Ti82 and on the Ti83+).
>
>Renaming a file is a bit more difficult, as a programs VAT entry can take
>variable amount of space (5 till 11 bytes). So you can't simply overwrite
>the name-string with a new one (unless you keep the string-size the same).
>The easiest/smallest way to do it I think is to first create a new 0 bytes
>file with the new name. Then swap the data/sizebytes-pointers between the
>old and the new entry. And at last remove the old entry (now pointing to
>the sizebytes of your 0 bytes program) via _delvar.
>
>There are off coarse more hacker'ish approaches for both of the problems
>(but why would you then want to use _insertmem?).
>
> Henk Poley <><
>
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp