Re: A83: Help :Z80 Compiler


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

Re: A83: Help :Z80 Compiler




How do you store strings to memory? Null-terminated or starting with a length
byte/word?

Still, all you have to do is compare them one character at a time. For
example (for nullterminated strings):

   ld    hl,firststring
   ld    de,secondstring
   call  comparestrings
   jr    z,...
   ...

comparestrings:
   ld    a,(de)
   cp    (hl)
   ret   nz     ;mismatch -> return
   and   a      ;actually "cp 0" but this saves one byte
   ret   z      ;end of strings reached
   inc   hl
   inc   de
   jr    comparestrings

This routine sets the Z flag if the strings in de and hl are equal. It
shouldn't be too hard to adapt for "BCPL Strings" (strings starting with one
byte describing the string length).

Linus

On 13-May-98, Jimmy Conner wrote:

>Is still need a little help.  I want to start making my Z80 compiler in 
>ASM but I don't have any idea how to compare to strings in asm?
>Any ideas anybody?


>If you would like to see some screen shots of my compiler goto my home 
>page at http://www.angelfire.com/tx/timagic/index.html
>and then goto my puds page.
>Sorry they aren't much but it gives you a little idea of that it 
>actually works.

>Today I incorporated User Defined Macro's and got the labels to some 
>what work.


>If anybody can offer any ideas or help, I will be greatful.

>Jimmy


>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com



References: