1 ;; Implementation of some string functions in
4 ;; Why - because I want a better dhrystone score :)
6 ;; strcpy is disabled as the C version is almost as good.
7 ;; Just the setup and return is slower.
9 ; char *strcpy(char *dest, const char *source)
11 ;; Fall through to the correct type
25 ;; Setup the return value
35 ;; Notes on strcpy styles:
36 ;; *de = *hl; hl++; de++; or a; ret z; jp - slower as jp is
37 ;; same cost as conditional jump, so condition on ret is more expensive.
38 ;; *de = *bc; bc++; de++; or a, jp nz - OK
39 ;; Can't use LDI as need to check for end of string.
40 ;; Above also matches the z88dk version.
43 ; void *memcpy(void *dest, const void *source, int count)
45 ;; Fall through to correct type
51 ;; LDIR: do; *DE = *HL; HL++; BC--; while BC != 0
53 ;; All registers are already saved.
54 pop iy ; iy = return address
55 pop de ; de = destination pointer
56 pop hl ; hl = source pointer
66 pop hl ; return hl = original destination pointer
71 ; int strcmp(const char *s1, const char *s2)
73 ;; Fall through to the correct style
74 ;; Fall through to correct type
95 ;; Normally not taken, so use a jr (12/7) instead of jp (10)
103 ;; Normally taken. Flag from the cp above.