Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
30
Task/String-matching/Z80-Assembly/string-matching-1.z80
Normal file
30
Task/String-matching/Z80-Assembly/string-matching-1.z80
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
InString:
|
||||
;input: hl = pointer to string 1
|
||||
; de = pointer to string 2
|
||||
; assumes len(hl) <= len(de)
|
||||
; output in BC
|
||||
;clobbers: ix
|
||||
push de
|
||||
pop ix ;back up de into ix
|
||||
ld bc,0 ;our return value
|
||||
InString_again:
|
||||
ld a,(hl)
|
||||
or a
|
||||
ret z
|
||||
|
||||
ld a,(de)
|
||||
or a
|
||||
ret z
|
||||
|
||||
cp (hl)
|
||||
jr nz,InString_noMatch
|
||||
inc de
|
||||
jr InString_overhead
|
||||
|
||||
InString_noMatch:
|
||||
push ix
|
||||
pop de
|
||||
inc bc
|
||||
InString_overhead:
|
||||
inc hl
|
||||
jr InString_again
|
||||
Loading…
Add table
Add a link
Reference in a new issue