A83: Resize a program...


[Next][Index][Thread]

A83: Resize a program...



Hi!

I want to resize a file from within a program, for dynamicly memory
allocating. 
To increse the filesize of an file with 20 bytes, i've wrote the
folowing code:

Main:   	ld hl,file
	rst 20h			; copy 9 bytes from (hl) to (OP1)
	call _chkfindsym
	push hl
	push de
	ld h,d
	ld l,e
	call _ldhlind		; ld hl,(hl)
	push hl
	inc de
	inc de
	add hl,de
	ex de,hl
	ld hl,20
	call _insertmem		; insert 20(=hl) bytes from de to 9327h
	pop hl
	pop de
	ex de,hl
	ld bc,-20
	add hl,bc
	ex de,hl
	push de
	ld bc,20
	add hl,bc
	ld a,l
	ld (de),a
	inc de
	ld a,h
	ld (de),a
	pop de
	pop hl
	dec hl
	ld (hl),e
	dec hl
	ld (hl),d
	ret
file:	.db     05,"TEST",0

When i run this program, the file 'TEST' gets 20 bytes larger, but not
the way i want it: it writes a new size-word 20 bytes before the start
and updates the vat, but the insertmem doesn't work: it just overlaps a
file/data before prgmTEST...

Can someone tell me what's wrong or help me with an working resizer????

Thanx for any help,

Sebastiaan Roodenburg
sebastiaan@rimsystems.nl

Warning
Could not process part with given Content-Type: application/ms-tnef

Follow-Ups: