[A82] Re: porting iondetect to the ti82


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

[A82] Re: porting iondetect to the ti82



Iondetect is a routine built into ion that searches for a program that 
contains a string.

input:
  hl = vat entry (use ld hl,(progptr) for first program)  Don't give it 
symtable
  ix = String to search the programs for
output:
  z=1 if program found
  hl = address inside the program after the string
  de = next vat entry
  destroys everything else

Rather than using a program name, it uses a detection string
DetectString: .db "MyCoolProgram",0
The biggest disadvantage to IonDectet is that it doesn't return the program 
name in op1.  you manually have to get the name out of the vat to display 
it.

This is the "iondetect" I ended up writing, it uses ace's calls.  (call 
FIND_INIT first)

AceDetect:
	call FIND_NEXT
	jr c,AceNotFound
	inc de
	inc de
	push ix
	pop hl
	call StrCmp
	jr nz,AceDetect
	ex de,hl
	xor a
	ret
AceNotFound:
	xor a
	inc a
	ret

;searches for (hl) inside (de), terminated by first 0 in (hl)
;input: hl = address of search string, de = address of data
;output: hl = stop position
;        de = location after hl or stop position
;        z = 1 if successful
;destroyed: a
strcmp:
	ld a,(hl)
	or a
	ret z
	ld a,(de)
	cp (hl)
	ret nz
	inc hl
	inc de
	jr strcmp

>
>>I also noticed that ACE has a frontend to _chkfindsym, but CrASH doesn't.
>
>I am not exactly sure what you mean, ACE handles ROM calls in a different 
>way because it support 19.006, but I do not think anything else has 
>changed.
>

I meant that crash doesn't have an equate for _chkfindsym.  Really annoying 
if you know the name of a program and want its address.

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail




Follow-Ups: