Category:84PCE:OS Information:VAT

From WikiTI
Jump to: navigation, search


;-------------------------------------------- 
; fdetect 
; detects appvars, prot progs, and 
; progs given a 0-terminated string 
; pointed to by ix. 
;-------------------------------------------- 
; INPUTS: 
; hl->place to start searching 
; ix->string to find 
; 
; OUTPUTS: 
; hl->place stopped searching 
; de->file data after string 
; bc=file size after string 
; z flag set if found, nz if not found 
;-------------------------------------------- 
fdetect: 
 ld de,(ptemp) 
 or a,a  
 sbc hl,de  
 add hl,de 
 ld a,(hl) 
 jr nz,fcontinue 
 inc a 
 ret 
fcontinue: 
 push hl 
 cp appvarobj 
 jr z,fgoodtype 
 cp protprogobj 
 jr z,fgoodtype 
 cp progobj 
 jr nz,fskip 
fgoodtype: 
 dec hl 
 dec hl 
 dec hl 
 ld e, (hl) 
 dec hl 
 ld d,(hl) 
 dec hl 
 ld a,(hl) 
 call _SetDEUtoA 
 push de 
 pop hl 
 cp 0D0h 
 jr nc,finRAM 
 push ix 
  push de 
   push hl 
   pop ix 
   ld a,10 
   add a,(ix+9) 
   ld de,0 
   ld e,a 
   add hl,de 
   ex (sp),hl 
   add hl,de 
  pop de 
  ex de,hl 
 pop ix 
finRAM: 
 inc de 
 inc de 
 ld bc,0 
 ld c,(hl) 
 inc hl 
 ld b,(hl) 
 inc hl    ; hl -> data 
 push bc   ; bc = size 
  push ix 
  pop bc 
fchkstr: 
  ld a,(bc) 
  or a 
  jr z,ffound 
  cp (hl) 
  inc bc 
  inc de 
  inc hl 
  jr z,fchkstr 
  pop bc 
fskip: 
 pop hl 
 call fbypassname 
 jr fdetect 
ffound: 
  push bc 
  pop hl 
  push ix 
  pop bc 
  or a 
  sbc hl,bc 
  push hl 
  pop bc 
  pop hl   ; size 
  or a 
  sbc hl,bc 
  push hl 
  pop bc 
 pop hl      ; current search location 
 push bc 
  call fbypassname 
 pop bc 
 xor a 
 ret 
fbypassname: 
 ld bc,-6 
 add hl,bc 
 ld b,(hl) 
 dec hl 
fbypassnameloop: 
 dec hl 
 djnz fbypassnameloop 
 ret

This category currently contains no pages or media.