!pr0
!lm12
!rm75
Sorting Out Zero-Page References.............Tracy L. Shafer

The search for page-zero references program in last month's AAL turned out to be (almost) the very thing I've been needing.

I have a clock card capable of generating NMI and IRQ interrupts.  Up to now, I haven't been able to do any deep research on the IRQ due to the DOS and monitor conflict mentioned in the January issue of AAL.  (They both use location $48.)  I can't modify the monitor because I don't have access to a PROM burner, and the thought of searching through DOS really put a damper on the IRQ project until now.

Since I didn't need to know every page-zero reference used by DOS, I modified the program to search for a specific page-zero reference.  That worked fine, but I didn't want to have to type in a separate search value for every group of references I might need later, so I further changed the program to print out all the references in numerical order of page-zero location.

To make the changes to the program as published last month, just remove the ".3" from line 1580 and add the following lines:

!lm17
1285 PAGE.REF .HS 00           VARIABLE TO HOLD THE
                               CURRENT ZERO-PAGE
                               LOCATION

1571 .3        INY             NEW PLACE FOR ".3" LABEL
1572           LDA (MON.PCL),Y GET PAGE REFERENCE
1573           DEY             RESTORE VALUE OF Y
1574           CMP PAGE.REF    ONE WE ARE SEARCHING FOR?
1575           BNE .6          NO, IGNORE THIS ONE

1861           LDX #1          RESTORE X-VALUE FOR
                               MON.A1PC ABOVE
1862           INC PAGE.REF    NEXT ZERO-PAGE ADDRESS
1863           BNE CTRL.Y      NOT FINISHED

!lm12

The program now searches through the memory range 256 times instead of just once, so it doesn't run nearly as fast, but it's easier to find all the references to specific locations.
