CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 06:23:30 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=526143b68a2c2fa1ffffd798314704383f5ef8b9daa3f1959dff7a424b7e1538a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22vv47zL54ZKeKbl3YERbHqmpR7Iivil7Z%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d48246f96ecb77-BLR
6502 Substring Finding Algorithm - Pastebin.com
SHARE
TWEET

6502 Substring Finding Algorithm
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Copyright-free! For any use!
- KickAssembler Substring Matching Subroutine.
- Finds the index of the first occurence of a substring (can be any encoding, just make sure both the
- string and substring are the same encoding!)
- Both strings MUST have a final NULL ($00 byte) character.
- Store the address of the string to search at $fb
- Store the address of the substring at $fd
- $c000 - $c002 are used as temp
- A & Y registers will be used.
- A <- boolean (0 or 1) on whether a match was found
- X <- index of the first occurence of the substring (if found, 0 if not found
- Y <- 0
- __$fb - $fc, $c000 - $c002 and Y are set to zero!__
- */
- find_substr: {
- .label stri = $3b
- .label subi = $3c
- .label finalindex = $2a
- .label stradd = $fb
- .label subadd = $fd
- lda #0 // index of the searched string
- sta stri
- lda #0 // index of the substring
- sta subi
- mainloop:
- ldy stri
- lda (stradd),y
- ldy subi
- cmp (subadd),y
- beq letter_match
- bne letter_mismatch
- letter_match:
- // letter matches, increment substring index
- inc subi
- jmp check
- letter_mismatch:
- inc finalindex
- lda #0
- sta subi
- check:
- ldy subi // check substring first, to prevent substring matches at the end of the
- // searched string from coming back false
- lda (subadd),y
- beq endsubreached // return true
- ldy stri
- lda (stradd),y
- beq endstrreached // return false
- inc stri
- jmp mainloop
- endsubreached:
- lda #1 // substring found
- ldx finalindex
- jmp end
- endstrreached:
- lda #0
- ldx #0
- jmp end
- end:
- ldy #0
- sty stradd
- sty subadd
- sty finalindex
- sty stri
- sty subi
- rts
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
✅⭐ Make huge profits on trading ⭐⭐ 9
JavaScript | 1 sec ago | 0.25 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 10 sec ago | 0.25 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ 8
JavaScript | 19 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ A
JavaScript | 28 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ O
JavaScript | 30 sec ago | 0.25 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ L
JavaScript | 37 sec ago | 0.25 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ 9
JavaScript | 40 sec ago | 0.25 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ H
JavaScript | 46 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand