Re: A86: Moving (memory locations): code


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

Re: A86: Moving (memory locations): code




if the strings are that short then just store the whole thing as one
string and move individual characters when you need to.  if you also need
to preserve the original string, keep two copies and only change one.

if the strings are longer than ~2 or 3 bytes or vary in length then use a
list of pointers to strings and do the same thing with those.  this
requires some slightly tricking dealing to display them all, but it's not
that bad.

something like:

	ld b,8
loop:	ld e,(hl)	; or use _ldhlind and inc hl twice somewhere
	inc hl
	ld d,(hl)
	inc hl
	push hl
	ex de,hl
	call _puts
	pop hl
	djnz loop

-josh

On Sun, 21 May 2000 13:45:26 -0400 "Ivan J. Becica" <ijbecica@erols.com>
writes:
> 
> >     Perhaps you could paste the part of your code you are having 
> trouble with
> > for us all to see. Then it would be easier to fix the problem.
> 
> Here is the relevant bit of code...
> 
> > #include "ti86asm.inc"
> >
> > .org _asm_exec_ram
> >
> >         call _flushallmenus
> >
> >         call DrawRoutine
> > MainLoop:
> >         call _get_key
> >         ;cp K_ENTER
> >         ;jr z, MoveAString
> >
> >         ;This is where I want to load, for example:
> >         ;string a into string b so the display reads
> >         ;aacdefgh- what is the best way to do this
> >
> >         cp K_EXIT
> >         ret z
> >         jr MainLoop
> >
> > DrawRoutine:
> >         ld hl,Strings
> >         xor a
> >         ld b,8
> > InnerLoop:
> >                 ld (_curRow),a
> >                 call _puts
> >                 djnz InnerLoop
> >
> >         call _homeup
> >         ret
> >
> > Strings:
> >         .db "a",0
> >         .db "b",0
> >         .db "c",0
> >         .db "d",0
> >         .db "e",0
> >         .db "f",0
> >         .db "g",0
> >         .db "h",0
> >
> > .end
> >
> 
> 
> 
> 
> 

________________________________________________________________
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.