Difference between revisions of "83Plus:BCALLs:42F7"
From WikiTI
(Quickly done, based off 83Plus:BCALLs:42FD) |
m |
||
Line 1: | Line 1: | ||
− | [[Category:83Plus:BCALLs:By_Name:Memory| | + | [[Category:83Plus:BCALLs:By_Name:Memory|InsertMem]] [[Category:83Plus:BCALLs:By_Name|InsertMem]] [[Category:83Plus:BCALLs:By_Address|42F7 - InsertMem]] |
== Synopsis == | == Synopsis == | ||
'''Official Name:''' InsertMem | '''Official Name:''' InsertMem |
Revision as of 17:18, 14 December 2009
Synopsis
Official Name: InsertMem
BCALL Address: 42F7
Adds RAM space into an existing variable.
Inputs
- HL = amount of RAM to insert into the variable
- DE = the memory address where the RAM will be inserted
Outputs
- DE = the memory addressed where the RAM was inserted. Equivilant to the input.
Destroys
- All
Remarks
- This routine will not check to see if there is insufficient RAM. It is highly suggested to do that beforehand, using the bcall EnoughMem.
- The size field of the variable is not updated. The user must do this himself.
- DE cannot be the first byte of the variable's data or else the symbol entry's pointer to the data will become corrupt (the first byte being the size field?).
Example
ld hl,9 B_CALL EnoughMem jr c,NotEnoughMem ;make sure there is enough memory to insert the RAM ld hl,ApplicationVariable rst rMov9ToOP1 B_CALL ChkFindSym ;find the application variable jr nc,AppVarNotFound inc de inc de ;move past the size bytes ld hl,9 B_CALL InsertMem ;insert 9 bytes here ex de,hl dec hl ld a,(hl) dec hl push hl ld h,(hl) ld l,a ;ld hl,(de). Load the size of the AppVar in hl ld de,9 add hl,de ;add 9 to hl ex de,hl pop hl ld (hl),e inc hl ld (hl),d ;Store the new size back into the AppVar ApplicationVariable: .db AppVarObj,"APPVAR",0