mirror of
https://github.com/a2-4am/anti-m.git
synced 2025-01-14 07:29:50 +00:00
cut the unused code
This commit is contained in:
parent
8b726bd256
commit
fc63ee2d9a
176
src/compare.a
176
src/compare.a
@ -1,180 +1,7 @@
|
||||
WILDCARD = $97
|
||||
|
||||
;-------------------------------
|
||||
; SearchPages subroutine
|
||||
; written by qkumba
|
||||
; search for a string occurring anywhere
|
||||
; in 16 consecutive pages of memory
|
||||
; #WILDCARD in search string matches any 1 byte
|
||||
; (like "." character in regular expressions)
|
||||
; in: A = page address
|
||||
; Y = string length
|
||||
; stack = string to find
|
||||
; out: C clear if string found
|
||||
; or set if not found
|
||||
; If C is clear, then
|
||||
; A = page where string was found
|
||||
; X = starting offset where string was found
|
||||
; all other registers and flags clobbered
|
||||
;-------------------------------
|
||||
SearchPages
|
||||
;set end point for the search
|
||||
|
||||
tax
|
||||
clc
|
||||
adc #$10
|
||||
sta .endvalue+1
|
||||
txa
|
||||
bne SearchPageImm
|
||||
|
||||
;-------------------------------
|
||||
; SearchPage subroutine
|
||||
; written by qkumba
|
||||
; same as SearchPages, but for a single page
|
||||
; in: A = page address
|
||||
; Y = string length
|
||||
; stack = string to find
|
||||
; out: C clear if string found
|
||||
; or set if not found
|
||||
; If C is clear, then
|
||||
; X = starting offset where string was found
|
||||
; all other registers and flags clobbered
|
||||
;-------------------------------
|
||||
|
||||
SearchPage
|
||||
;set end point for the search
|
||||
|
||||
tax
|
||||
inx
|
||||
stx .endvalue+1
|
||||
|
||||
; set high part of initial search position
|
||||
|
||||
SearchPageImm
|
||||
sta search+2
|
||||
pla
|
||||
sta match_buffer1+1
|
||||
sta match_all+1
|
||||
pla
|
||||
sta match_buffer1+2
|
||||
sta match_all+2
|
||||
tax
|
||||
sty match_size1+1
|
||||
sty match_size2+1
|
||||
|
||||
; fetch last byte to improve search speed
|
||||
|
||||
match_buffer1
|
||||
lda $d1d1,y ; modified at runtime
|
||||
sta check_byte1+1
|
||||
sta check_byte2+1
|
||||
|
||||
; set low part of initial search position
|
||||
|
||||
tya
|
||||
dey
|
||||
sty cont_search+1
|
||||
|
||||
; set return address
|
||||
|
||||
clc
|
||||
adc match_buffer1+1
|
||||
tay
|
||||
bcc plus01
|
||||
inx
|
||||
plus01
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
|
||||
; set match position
|
||||
|
||||
inc match_all+1
|
||||
bne plus02
|
||||
inc match_all+2
|
||||
plus02
|
||||
|
||||
lda #<cont_search-branch_cont-2
|
||||
sta branch_cont+1
|
||||
|
||||
; search...
|
||||
|
||||
cont_search
|
||||
ldy #$d1 ; modified at runtime
|
||||
|
||||
search
|
||||
lda $d100,y ; modified at runtime
|
||||
iny
|
||||
beq check_end
|
||||
|
||||
check_byte1
|
||||
cmp #$d1 ; modified at runtime
|
||||
bne search
|
||||
|
||||
; point to first byte
|
||||
|
||||
sty cont_search+1
|
||||
|
||||
check_match
|
||||
tya
|
||||
|
||||
match_size1
|
||||
sbc #$d1 ; modified at runtime
|
||||
sta match_buffer2+1
|
||||
ldx search+2
|
||||
bcs plus03
|
||||
dex
|
||||
plus03
|
||||
stx match_buffer2+2
|
||||
ldy #$00
|
||||
|
||||
match_all
|
||||
lda $d1d1,y ; modified at runtime
|
||||
cmp #WILDCARD
|
||||
beq found_wild
|
||||
|
||||
match_buffer2
|
||||
cmp $d1d1,y ; modified at runtime
|
||||
|
||||
branch_cont
|
||||
bne cont_search
|
||||
|
||||
found_wild
|
||||
iny
|
||||
|
||||
match_size2
|
||||
cpy #$d1 ; modified at runtime
|
||||
bne match_all
|
||||
|
||||
; point to start of match
|
||||
|
||||
ldx match_buffer2+1
|
||||
lda match_buffer2+2
|
||||
clc
|
||||
rts
|
||||
|
||||
; cold path
|
||||
|
||||
check_end
|
||||
inc search+2
|
||||
ldx search+2
|
||||
.endvalue
|
||||
cpx #$D1
|
||||
bne check_byte1
|
||||
ldx #<all_done_set-branch_cont-2
|
||||
stx branch_cont+1
|
||||
|
||||
check_byte2
|
||||
cmp #$d1 ; modified at runtime
|
||||
beq check_match
|
||||
|
||||
all_done_set
|
||||
sec
|
||||
rts
|
||||
|
||||
;-------------------------------
|
||||
; compare subroutine
|
||||
; CompareMemory subroutine
|
||||
; in: A = page
|
||||
; X = offset
|
||||
; Y = string length
|
||||
@ -191,7 +18,6 @@ all_done_set
|
||||
; stack set to first instruction after string
|
||||
;-------------------------------
|
||||
!zone {
|
||||
compare
|
||||
CompareMemory
|
||||
sta cmp1+1
|
||||
stx cmp1
|
||||
|
@ -2,7 +2,7 @@ IDAntiM
|
||||
lda #8
|
||||
ldx #1
|
||||
ldy #11
|
||||
jsr compare
|
||||
jsr CompareMemory
|
||||
!byte $A2,$00 ;LDX #$00
|
||||
!byte $BD,$00,$08 ;LDA $0800,X
|
||||
!byte $9D,$00,$02 ;STA $0200,X
|
||||
|
@ -12,7 +12,7 @@ IDSpiraDisc
|
||||
lda #8
|
||||
ldx #1
|
||||
ldy #12
|
||||
jsr compare
|
||||
jsr CompareMemory
|
||||
!byte $86,$0A ;STA $0A
|
||||
!byte $8E,WILDCARD,WILDCARD ;STA $xxxx
|
||||
!byte $8E,WILDCARD,WILDCARD ;STA $xxxx
|
||||
|
Loading…
x
Reference in New Issue
Block a user