From WikiTI
Jump to: navigation, search

Finding an app's name

One, the page states "NZ set if not found". That is ... confusing, to say the least. Does it mean Z is reset if not found, or something else?

Two, it took me some experimenting to figure out how to find an app's name. The examples are somewhat misleading as to what values you provide when searching an app. Here's the code I use to find an app's name given its basepage:

  ; a is the app's basepage
  push af
  ld hl,$4000
  ld de,$8040			; app name field
  ; technically the name could not be found but that will not happen
  pop af
  ; a:hl points to the name

Andy Janata 15:15, 14 August 2007 (PDT)

Yeah, I don't know what I was thinking when I said 8000 for the address. Sorry about that. As for Z/NZ... yeah, maybe better notation is in order. By "NZ is set" I mean that the zero flag is cleared; thus, the NZ condition is true. Most if not all of the field search routines will return with the zero flag set (Z) if they find the given field, or cleared (NZ) if they don't.
Incidentally, yes, I would say it's safe to assume that every app has a name. And it's probably safe to use this routine (or FindOSHeaderSubField) to search app headers, because that's what the OS does, but it's not 100% foolproof in the case that the field you're looking for doesn't exist. This is because it doesn't actually stop at the program image field -- rather, when it gets to that field, it skips 70h bytes (because of the bug in GetFieldSize) and continues on its way.
FloppusMaximus 18:23, 14 August 2007 (PDT)
Actually, in my quest to try to get it to work, I changed my equate to point to GetApp... When I noticed that was the case, I changed the text of the equate as well. Changed above to reflect that. Andy Janata 07:53, 15 August 2007 (PDT)