Re: LZ: A new programming question


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

Re: LZ: A new programming question



At 16:18 12/18/96 -0800, you wrote:
>There is one asm command you could use, ldir.  It means load hl into de 
>while increasing addresses until bc equals 0.  so...
>
>ld hl,$80E1	;source of stuff
>ld de,$80E0	;destination of stuff
>ld bc,$0003	;amount of stuff, or bytes you want to move
>ldir
>
>By the way, there is no chance of overlapping problems.  This routine is 
>especially good if you're moving lots and lots of bytes, like some 
>programs do to load pictures from graph mem to video mem.  You can have 
>the fun of working out the other things, like how to calculate bc(bytes 
>to move), and stuff like that.
>
>-- 
>Compliments of:
>_-_-_-_-_-_-_-_
>  Alan Bailey
>  mailto:bailala@mw.sisna.com
>  IRC:Abalone
>  Web:http://www.mw.sisna.com/users/bailala/home.htm
>
OK, I've been trying to get this to work but I haven't been able to yet.  I
am writing a text editor and I need to be able to insert text.  When I call
the subroutine for ldir, hl points to the next byte in memory to be written.
The memory will look something like this after some text like abcde has been
entered:

$80DF = $01
$80E0 = a
$80E1 = b
$80E2 = c
$80E3 = d
$80E4 = e
$80E5 = $02

$01 is the code for the start of the file
$02 is the code for the end of the file

Now say I wanted to insert a letter between b & c. hl would point to $80E2.
I need a routine that I could call that would increment the memory and leave
hl pointing to the same address that it did when the routine was called.
Usually I can figure these things out on my own but I think I'm becoming
lazy.  Anyway, any help would be greatly appreciated.
Nathan Adams
nathana@goodnet.com
"It is better to remain silent and be thought a fool,
than to speak out and remove all doubt."


Follow-Ups: