home *** CD-ROM | disk | FTP | other *** search
- Tracker
- =======
-
- Tracker is a simple little utility which I wrote ages ago. At the time it
- was hard to justify the effort in terms of the project I was working on, but
- it's paid back many times over now.
-
- It allows applications, modules and any other code which can either write to
- a file or issue an SWI to write textual information to a trace window which
- appears, and updates, on the desktop at the next null event.
-
- Shortcomings
- ============
-
- A lot if it looks rather naive to me now. There is at least one known bug
- which means it can't save output directly to an editor. I had a quick look
- at it prior to posting it here, but it wasn't immediately obvious. Perhaps
- if anyone fixes it they'd let me know. Also it currently uses SWI chunk
- CF000 which is not allocated by Acorn. Feel free to change it. I know I
- should register it but I've never got around to it.
-
- Interface
- =========
-
- SWI Tracker_Open -- open a new tracker window
-
- R0 ==> Title for this window (ASCIIZ)
- R1 ==> Width of window in characters
- R2 ==> Height of window in characters
- R3 ==> Flags: bit 0 means treat LF as CRLF which is useful for C
-
- On exit
-
- R0 ==> Handle of new window
-
- SWI Tracker_Close -- close a tracker window
-
- R0 ==> Handle to close
-
- NOTE: When a Tracker window is closed it doesn't disappear from the screen.
- What this call does is mark the window 'OK to close' which means that if you
- click on it's close icon it won't complain. To reflect this change of state
- the text in it goes grey.
-
- SWI Tracker_SetPos -- set cursor position
-
- R0 ==> Handle of window
- R1 ==> New cursor X position
- R2 ==> New cursor Y position
-
- Allow the cursor to be repositioned in a Tracker window.
-
- SWI Tracker_WriteS -- write a string to a Tracker window
-
- R0 ==> Handle of window
- R1 ==> String
-
- The following control codes are handled 08, 09, 0A, 0B, 0C, 0D, 7F. All
- others are ignored. Top bit set characters are processed normally.
-
- SWI Tracker_CLS -- clear a tracker window
-
- R0 ==> Handle of window
-
- SWI Tracker_Simple -- simple output
-
- R0 ==> String to output
-
- A simpler interface to the Tracker module for code which can't be bothered
- to keep track of window handles. The first time this call is made a new
- Tracker window measuring 80x1000 characters is opened and the given string
- is written to it. Subsequent calls write the string at R0 to the same
- window. If you close it, the next call to Tracker_Simple opens a new one.
-
- Filing system
- =============
-
- A file can be opened on TrackFS: like this
-
- track% = OPENOUT "TrackFS:Spog"
-
- Any data written to this file will appear in the window. Optionally the file
- name can be suffixed with the size of the window, as in
-
- track% = OPENOUT "TrackFS:Spog_80_100"
-
- The file name is the bit up to the first '_' for the purposes of name
- matching.
-
- Assembler
- =========
-
- I write quite a lot of modules, so I produced a debugging library which I
- can link modules with which gives them the benefit of easy access to
- Tracker. The code is included in AsmLib.
-
- To use it you need to
-
- GBLL Debug
- Debug SETL {TRUE} ; or {FALSE}
-
- GET Somepath:s.DebugHdr
-
- and in your module initialisation you can do something like
-
- DBSET DebugOn :OR: UseTracker ; UseVDU, UseBeeb and UseRam are
- ; also allowed
- DBF "\fStarting\n\n"
-
- and link with
-
- Somepath:o.debuglib
-
- If Debug is {FALSE} no extra code will be generated or linked.
-
- Within your code you can now do things like
-
- DBF "r0 is %0w and r9 is %9w\n"
-
- which would display in the Tracker window
-
- r0 is 12345678 and r9 is 87654321
-
- DBSET Macro
-
- The argument to DBSET is a bitfield which indicates whether debugging is
- enabled, and if it is enabled, where the output should go to. UseTracker
- specifies that output should be sent to Tracker. UseVDU states that output
- should go to the screen. You shouldn't use this option for interrupt code.
- UseBeeb sends output to a user port if you have one fitted. The reason why
- it's called UseBeeb is because when I wrote it I accessed the debug output
- by plugging an old BBC Micro into the other end. UseRam stores debug output
- in a RAM board I wirewrapped ages ago. The advantage is that debug output
- stored on the RAM board will survive over a hard reset. Unless you happen to
- have an identical board (unlikely) you can't use this option I'm afraid.
-
- DBF Macro
-
- DBF outputs a formatted string to the current debug destinations. Within the
- string, a '%' specifies a conversion and '\' introduces and escape.
-
- The general format of conversions is
-
- %<register>[<radixspecifier>]<conversion>
-
- where register can be '0' - 'F' or 'R0' - 'R15' or SP, LR or PC. Case is
- insignificant.
-
- The radix specifier is
-
- % for binary,
- # for decimal
-
- The default is hex.
-
- The conversion character specifies how the data is to be output as follows
-
- s -- string (null terminated I think; check the source)
- w -- word (i.e. 32 bits)
- h -- half word
- b -- byte
- c -- character
-
- In addition,
-
- %z and %t
-
- insert the value of a centisecond clock into the output. %z also zeros the
- clock so that successive %zs output the time difference since the last %z,
- and successive %ts output the total time since the last %z.
-
- A DBF can be made conditional as in
-
- DBF "It's not equal\n", NE
-
- Conclusion
- ==========
-
- As I said, it's a little bit crude but it's performed well for me over the
- years.
-
- If you run into any problems or you improve it at all let me know.
-
- Andy Armstrong, andy@armswalk.demon.co.uk
-