home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / abztos.arc / ABZMON.DOC next >
Encoding:
Text File  |  1985-06-01  |  20.9 KB  |  443 lines

  1.  
  2. ************************************************************************
  3. **************************     ABZMON2    ******************************
  4. ************************** by Alain Birtz ******************************
  5. ************************************************************************
  6.  
  7.  This program was first written for the FASTER news disk. You can
  8. contact the FASTER group on their BBS: 514-489-0680 or 514-489-3489.
  9. ABZMON2 is now a public domain program; you may copy and distribute
  10. it freely.
  11.  
  12.  The ABZMON menus are in the form:
  13.  
  14.      Alpha  Bravo  Exit:
  15.  
  16.  The user may select any option by typing its first letter only (in
  17. upper or lower case). The default option is always the first item of
  18. any menu. By example, for selecting the "Alpha" choice, you need only
  19. to press the <Return> key. But to select the "Bravo" option, you need
  20. to type 'B' or 'b', and confirm your choice by pressing the <Return>
  21. key. Any invalid typing confirmed by <Return> key (here, other than A,
  22. B, E, a, b, e) will re-display the same menu.
  23.  
  24.  When the program will ask you to enter an address or other value,you
  25. may type it in hexadecimal form like: 12ea5 or 12EA5. But if the value
  26. is preceded by the symbol '#' you can use the decimal form as: #77477.
  27.  
  28.  There's are important keys: the <UNDO> or the 'Q' or 'q' keys; hitting
  29. any of these keys will stop the current process and the main menu will
  30. be displayed. Some menus also have an Exit option (type 'E' or 'e',
  31. followed by <Return>) doing the same job.
  32.  
  33.  The main menu is:
  34.  
  35.  Disasm Trace Hexed Search Free Move Load Break Go Regs CCR Info Exit:
  36.  
  37.  the meaning of each option is:
  38.  
  39. - Disasm: disassemble in the Motorola 68K mnemotechnic key word form
  40.           with leading hexadecimal code
  41.  
  42. - Trace:  single step execution of the program with disassembled
  43.           instruction, status flags and register values displayed
  44.  
  45. - Hexed:  full screen hexadecimal and/or ascii EDITOR
  46.  
  47. - Search: ascii or hexadecimal search with wild card char:
  48.           '?' will replace any single character, same position
  49.  
  50. - Free:   reserve and/or display the free memory available
  51.  
  52. - Move:   data transfer from file/memory to file/memory
  53.  
  54. - Load:   load a program into memory
  55.  
  56. - Break:  set a breakpoint and the frequency of this breakpoint
  57.  
  58. - Go:     start execution of a program at a given address, exit at the
  59.           breakpoint if any, or at a bug, or at the end of a program.
  60.  
  61. - Regs:   display/set address or data registers
  62.  
  63. - CCR:    set the CCR register
  64.  
  65. - Info:   display the current file information
  66.  
  67. - Exit:   return to the desktop
  68.  
  69. Note: In version 2.0, the other control key substitutions have been
  70. activated in order to make the program friendlier and easier to use. The
  71. cursor movement keys may be substituted with the 'L' ('l') for left, 'R'
  72. ('r') for right, 'U' ('u') for up, and 'V' ('v') for down. We cannot use
  73. the 'D' ('d') key because it's already used and would conflict with the
  74. hexadecimal notation system. The 'Q' ('q') and UNDO keys are now all
  75. used for the same function (to abort the current process).
  76.  
  77.  The next section will describe each item of this main menu in detail.
  78.  
  79.  The first four options (Disasm Trace Hexed Search) accept many input
  80. or output devices. When calling any one of these options, the user
  81. will first see the OUTPUT menu:
  82.  
  83.  output-> Screen, Printer, File, Exit:
  84.  
  85.  As the Screen is the first item of this menu, you may select it by
  86. pressing the <Return> key alone. The File option will prompt for a file
  87. name. Warning: no information about an existing file will be given, and
  88. in this case the file will be overwritten.
  89.  
  90.  Remember: the UNDO, 'Q', or 'q' keys exit to the main menu, stopping
  91. the activity of the printer or closing the (incomplete) output file. If
  92. the output is File or Printer, hitting the space bar will freeze the
  93. output, hitting one more time will continue the output. The default path
  94. name will be always the drive (and the folder, if any) from which you
  95. have loaded the ABZMON.TOS program. So, if ABZMON was loaded from hard
  96. disk "D:\MON.SRC", any file or program stored in this drive and folder
  97. will need only their file name to be accessible to you. Any other file
  98. or program will ask for a full path name.
  99.  
  100.  Note: you can use wildcards * and ? in the file name.
  101.  
  102.  Next, the user will see the INPUT menu:
  103.  
  104.  input-> Memory, Prg file, Data file, Exit:
  105.  
  106.  The Memory option needs a start address (if the 'current address', as
  107. displayed by Info option is the address needed; only press the <Return>
  108. key at the 'start address:' prompt). And if the output is File or
  109. Printer you will also need to give the end address. Input file can be
  110. of two kinds: The program file (Prg file option) loads a program in
  111. memory, relocates all position dependant addresses, displays the base
  112. page info (length and start address of the text, data and bss) and sets
  113. the 'current address' to the first instruction of the program.
  114.  
  115.  The second type of input file is the data file. When the Data file
  116. option is selected, the file is just copied in memory, whether the file
  117. is a program file or a real data file. The start and the end addresses
  118. of this data file is then displayed. But 'current address' will not be
  119. affected.
  120.  
  121.  Now a word about the 'current address'. This address is the default
  122. start address for the Memory input option (the default for the end
  123. address is the start address + $ffff). This address is updated each
  124. time a program is traced; also, after going through a Go option, this
  125. address will be set to the breakpoint address. Such updating will give
  126. a new default start address.
  127.  
  128.  ------------ Disasm
  129.  
  130.  The output form is like:
  131.  
  132.  000B9AC2   10D9                        MOVE.B  (A1)+,(A0)+
  133.  000B9AC4   51CA FFE8                   DBRA    D2,$B9AAE
  134.  000B9AC8   4E75                        RTS
  135.  
  136.  The first field is the hexadecimal address of the instruction, the
  137. second field is the hexadecimal instruction code, and the third is the
  138. Motorola 68K mnemotechnic key word. If the screen is the output, hit a
  139. key to see the next instruction or press the <UNDO> key to return to
  140. the main menu. Unknown instructions are singled out by the question
  141. mark (?).
  142.  
  143.  ------------ Trace
  144.  
  145.  The output form is like:
  146.  
  147.   000BA25A   status: -----    ANDI.B     #$F,D0
  148.  D 00003501 00000007 0016D741 00000000 00000000 00000000 00000000 00000000
  149.  A 000BB2E9 00000000 00000000 00000000 0016D741 00000000 00000000 000B8900
  150.   000BA25E   status: -----    BSR        $BA26A
  151.  D 00003501 00000007 0016D741 00000000 00000000 00000000 00000000 00000000
  152.  A 000BB2E9 00000000 00000000 00000000 0016D741 00000000 00000000 000B88FC
  153.   000BA26A   status: -----    ADDI.B     #$30,D0
  154.  D 00003531 00000007 0016D741 00000000 00000000 00000000 00000000 00000000
  155.  A 000BB2E9 00000000 00000000 00000000 0016D741 00000000 00000000 000B88FC
  156.   000BA26E   status: -N--C    CMPI.B     #$39,D0
  157.  D 00003531 00000007 0016D741 00000000 00000000 00000000 00000000 00000000
  158.  A 000BB2E9 00000000 00000000 00000000 0016D741 00000000 00000000 000B88FC
  159.   000BA272   status: -N--C    BGT        $BA27A
  160.  D 00003531 00000007 0016D741 00000000 00000000 00000000 00000000 00000000
  161.  A 000BB2E9 00000000 00000000 00000000 0016D741 00000000 00000000 000B88FC
  162.  
  163.  The first line begins with the address of the instruction, followed by
  164. the status flag and the mnemotechnic key word. If the Screen is the
  165. output, this line is displayed in reverse video mode. The next two
  166. lines are the values of the data and address registers, from 0 to 7.
  167.  
  168.  The status flags X,N,Z,V,C (Extended, Negative, Zero, oVerflow, Carry)
  169. are shown by their first letter if set, otherwise only a minus sign
  170. is shown.
  171.  
  172.  At program address $BA272, above, only the Negative and Carry flags
  173. are set.
  174.  
  175.  With Screen output, hitting a key will display the next instruction.
  176. If the output is a File or the Printer, the output is also driven to
  177. the screen, but in a continuous display. Hitting the space bar will
  178. freeze the display, so the user will be able to see where the program
  179. is. Hitting the space bar again will continue the display. Emergency
  180. exit is provided by the <UNDO> key.
  181.  
  182.  The ABZMON will trace only TRAP, TRAPV and CHK exceptions. Other
  183. exceptions produce unpredictable result. ABZMON can also lose control
  184. when executing DOS functions like GEM DOS Pterm function (in this case,
  185. returns to desktop). If the program climbs the stack and passes over
  186. the initial stack state, a message is sent and the Trace process exits
  187. to main menu.
  188.  
  189. Note: Version 2.0 contains a nice feature (so everybody tells me!). The
  190. possibility to quickly go through the subroutine with a press of the
  191. left cursor key (also with the 'L' or 'l' keys). This will cause ABZMON
  192. to go through and cleanly return from the subroutine without bothering
  193. you with information you already know about that part. The program will
  194. report the number of instructions executed before the return from the
  195. subroutine. Symetrically, you may access to the next routine with a
  196. press of the right cursor key ('R' or 'r'). Any alterations (up or down)
  197. of the stack will be detected. The '=' key will detect and report the
  198. first alteration to the stack and break the execution of the current
  199. program at the address of the instruction which brought about a change
  200. of the stack pointer.
  201.  
  202.  ------------ Hexed
  203.  
  204.  This is a powerful examine-modify memory/file tool. The output form is:
  205.  
  206.  000B8AA4  69 66 20 65 78 69 73 74 20 25 31 20 70 61 75 73 if exist %1 paus
  207.  000B8AB4  65 0D 0A 61 73 36 38 20 25 31 2E 73 0D 0A 6C 69 e..as68 %1.s..li
  208.  000B8AC4  6E 6B 36 38 20 25 31 0D 0A 72 6D 20 25 31 2E 6F nk68 %1..rm %1.o
  209.  
  210.  The first field is the hexadecimal address, the second field is the 16
  211. next bytes values (in hexadecimal) starting at that address and the
  212. third is the ascii characters for these values. If the output is the
  213. Screen, the first and the third fields are in reverse video mode for
  214. more readability and the third field uses the full ST character set. If
  215. the input is a File, the address in the first field is the offset from
  216. the beginning of the file.
  217.  
  218.  To examine, move the cursor up and down. If the cursor is already at
  219. the top or bottom line, the screen will scroll to display another line.
  220. To modify, move the cursor left and right on the second field. At the
  221. right byte, change the hexadecimal value. You must enter this value at
  222. the first digit of the byte, and then, you must forcibly enter the
  223. second digit.
  224.  
  225.  Another way to modify values is by using the ascii character field. To
  226. enter this field, hit the RIGHT-SHIFT key (to exit LEFT-SHIFT) and then
  227. enter text in the usual way. After the 16th character, the cursor moves
  228. down to the first character of the next line. You can move the cursor
  229. within this field with the down, up, left and right cursor keys.
  230.  
  231.  The <UNDO> key exits to the main menu. At this point, if the input is
  232. a file and if a byte has been modified, ABZMON.TOS will ask to save the
  233. modified file.
  234.  
  235.  ------------ Free
  236.  
  237.  Gives the amount of free memory. Some memory can also be reserved. The
  238. Free menu is like:
  239.  
  240.  bytes free $0003f560    need:
  241.  
  242.  Here, $3f560 (259 424) bytes are available, if you just hit <Return>
  243. no memory will be reserved, otherwise, type the number of bytes needed.
  244. ABZMON will reply with the start and end addresses of the memory block
  245. reserved.
  246.  
  247.  ------------ Move
  248.  
  249.  Data transfer from file/memory to file/memory. If the source and/or
  250. destination is memory you must supply the start (and end) addresses,
  251. otherwise, a file name is needed. You can reserve some room in memory
  252. via the Free option in the main menu.
  253.  
  254.  The move menu is:
  255.  
  256.  1- file to memory  2- memory to file  3- memory to memory  0- exit:
  257.  
  258.  ------------ Load
  259.  
  260.  Loads a program in memory, relocates all position dependant addresses,
  261. displays the base page info (length and start addresses of the text,
  262. data and bss) and sets the 'current address' to the first instruction
  263. of the program.
  264.  
  265.  ------------ Break
  266.  
  267.  Use this option to set a breakpoint. ABZMON.TOS will ask you for the
  268. breakpoint address, then you will see "how many times:". If you want a
  269. normal breakpoint, just hit <Return>. And when you'll select the Go
  270. option, ABZMON.TOS will stop the program's execution at the previously
  271. given address and display the state of the status flag, the value of
  272. the address and data registers and set the 'current address' to the
  273. next instruction to be executed, which will be the breakpoint address.
  274.  
  275.  If you do not want the program to stop at the first time, give any
  276. needed value, ex. #117, then ABZMON will count (from 1) the number of
  277. times that program passes by the (breakpoint) address and will stop
  278. the program's execution when the count will be 117. The default number
  279. of iterations before a breakpoint is 1.
  280.  
  281.  Warning: the breakpoint address must not be set in a middle of an
  282. instruction or otherwise, unpredictable results will occur, the address
  283. must be the beginning of the instruction. Use the Disasm option to find
  284. the correct address.
  285.  
  286.  Note also that the program stops BEFORE executing the instruction at
  287. the breakpoint address. So if you have asked for 117 passes, your
  288. program execution will be stopped just before the execution of the
  289. 117th pass.
  290.  
  291.  ------------ Go
  292.  
  293.  The Go menu is:
  294.  
  295.  start address:
  296.  
  297.  ABZMON starts the execution of the program at the given address. If
  298. you just hit <Return> execution begins at the 'current address'. ABZMON
  299. exits at the breakpoint address, if a breakpoint is set. Otherwise the
  300. program will probably return to the desktop.
  301.  
  302.  ------------ Regs
  303.  
  304.  With this option you can at any time change the value of the data
  305. and/or register value. When calling this option you will see something
  306. like this:
  307.  
  308.  D 00003531 00000007 0016D741 00000000 00000000 00000000 00000000 00000000
  309.  A 000BB2E9 00000000 00000000 00000000 0016D741 00000000 00000000 000B88FC
  310.  
  311. but in reverse video mode, and the cursor will be located at the value
  312. of the D0 register. You can move the cursor to any register and at any
  313. digit inside the register value with the left, right, up and down
  314. cursor keys. You can change a register value by changing any of its
  315. digit values. Use <UNDO> keys to return to the main menu.
  316.  
  317.  ------------ CCR
  318.  
  319.  The CCR is stored in bits 0-4 in the lower byte of the Status
  320. Register, bits 5-7 are not used. When ABZMON asks for a new value of
  321. the CCR register. Simply hit the <Return> key if you do not wish to
  322. change anything or else, give an appropriate value (from $00 to $1F).
  323.  
  324.  Exemple: Look at line $000BA272 in the output example of the Trace
  325. instruction. The CCR is -N--C and you want to clear the N bit and set
  326. the Z bit in order to have a CCR like this: --Z-C (bit value= 00101).
  327. You will type '5' (which is $05 or %00000101) confirmed by <Return>. To
  328. have all flags set (bit value=11111), you will type '1F' or '1f'.
  329.  
  330.  ------------ Info
  331.  
  332.  Gives the info on the last program loaded in memory: file name, length
  333. and addresses of the text, data and bss, and the value of the 'current
  334. address'. Also gives the info about the last data file: file name and
  335. start and end addresses. If you have more than one data file in memory,
  336. the Info option will not provide info on data files except for the last
  337. one. But first loaded, data files are still in memory. Many data files
  338. can sit at the same time in memory, but when a program is loaded, all
  339. free memory is allowed to the program execution, so only one program
  340. may be in memory at the same time. However you can load a new program,
  341. the old one will be overwritten by the new program. Remember to move to
  342. disk all needed data files in memory before loading a program file.
  343.  
  344.  This is a safe way if something has to go wrong. With Raoul's 1040ST,
  345. we were able to put in memory a data file (using Disasm, output Screen,
  346. input Data file) after loading a program. But with my 520ST (upgraded
  347. to 1 Meg), I was unable to do the same, all attempts resulted in an I/O
  348. error no $0027.
  349.  
  350.  ERROR MESSAGES:
  351.  
  352.  If an Input-Output error is generated when ABZMON.TOS is working for
  353. you, you will be notified by a message giving the hexadecimal ID number
  354. of the error like: "I/O error no $0021". If you wish to know the
  355. meaning of those numbers, you will have to look at a book giving
  356. information on GEM such as "INTERNALS" from Abacus Software (page 139
  357. and 146). The ID numbers from $0001 to $001F are for the BIOS or XBIOS
  358. and numbers from $0020 to $0031 are for the GEMDOS. When such errors
  359. occur, press the <Return> key.
  360.  
  361.  When your program is executed by the Go option or traced by the Trace
  362. option, a Bus error, Address error or Illegal instruction error will
  363. stop the process and the error type will be displayed with three
  364. addresses like: "Bus error at: $57A28 [$5288C $55CF8]". The first
  365. address is the PC at fault. The last two addresses are (generally) the
  366. sub routine address where the instruction came from. WARNING!! Some
  367. desk accessories (like THUNDER when activated) may interfere with
  368. ABZMON.TOS, so we strongly suggest you to make a special ABZMON.TOS
  369. boot disk with only the essential desk accessories files.
  370.  
  371.  When ABZMON.TOS loads a program in memory, it will place it according
  372. to the available memory at the loading time. So, in order to have the
  373. same starting address and same relative addresses in a listing, from
  374. one ABZMON.TOS session to any other, you will have to load your program
  375. just after recalling the ABZMON.TOS. Any use of the Free option before
  376. loading a program will put it higher in the memory, making the starting
  377. address and relative addresses different from a previous work session.
  378. Same when reloading a program without using the Exit option. If this
  379. happens, you will have to calculate an offset for each relative address
  380. when comparing a previous listing with the new one.
  381.  
  382.  A SHORT SESSION ON ABZMON:
  383.  
  384.  You have worked very hard to compose your program, but there is a bug
  385. and you don't know where it is. Do not use DDT or SID stuff, just call
  386. "ABZMON.TOS" instead.
  387.  
  388.  Have a copy of your program on the "ABZMON.TOS" disk and after booting
  389. call "ABZMON.TOS". Select from the main menu the Load option and give
  390. as path name the file name of your program. As the 'current address' is
  391. now pointing to the first instruction of your program, select the Go
  392. option and just hit the <Return> key. This will execute your program
  393. from its first instruction. But as soon as the ST will try to execute
  394. the bugged instruction, the  process will be stopped and an error
  395. message will be displayed like: Address error at: $B8020 [$B6A40
  396. $B7ACC]. The bug is probably in the neighbourhood of $B8020.
  397.  
  398.  Now, as it is best to exit from "ABZMON.TOS", write down these
  399. addresses and the starting address of your program, then Exit. This
  400. will clear all registers. Recall "ABZMON.TOS" and reload your program.
  401. The 'current address' of your program should be the same as previously.
  402. It is possible to reload your program without going through the Exit
  403. option, but in this case, it will be loaded some few bytes higher in
  404. the memory and you will have to calculate an offset. The next step will
  405. be to Disasm your program in order to find the beginning address of an
  406. instruction before the suspected one (like $B8020). After finding such
  407. addresses, press the <Undo> key to exit from the Disasm mode. Now, use
  408. the Break option to set a breakpoint at the located address like $B8012.
  409. After, you will use the Go option to execute your program from its
  410. first instruction.
  411.  
  412.  "ABZMON.TOS" will stop your program execution at the breakpoint
  413. address and set the 'current address' to the breakpoint (like $B8012).
  414. Then select the Trace option. Press the <Return> key three times, one
  415. for the default output (Screen), one for the default input (Memory) and
  416. the last one for the default address (current address). Now, any key
  417. press (except the <Undo> key) will execute only one instruction at a
  418. time and will display the Trace information. When the monitor tries to
  419. run the bug, ABZMON.TOS will display an error message giving the error
  420. type and three addresses. The bug is there. Look at the value of the
  421. registers, you should find the bug as an odd address (ex. $16B25). Now
  422. you will need to examine the program in more detail to see where the
  423. bug comes from, like me with my odd address bug.
  424.  
  425.  I do Info to find the text segment of the program (start and end
  426. addresses), then Disam, with output driven to the Printer, input being
  427. Memory from the start address to the end of the text segment. I now
  428. have a complete listing of the program. Using the Trace again, in
  429. conjunction to the listing, I find my error in few minutes.
  430.  
  431.  ACKNOWLEDGMENTS TO:
  432.  
  433. -My brother Daniel for his relevant suggestions for improvement.
  434.  
  435. -Raoul Charbonneau and Alain Plouffe who have participated in the
  436. writing of the documentation and the testing of ABZMON.TOS.
  437.  
  438.                                        Alain Birtz
  439.                                        1683 Haut de la Riviere Sud,
  440.                                        St-Pie, P.Q., Canada J0H-1W0
  441.  
  442.                                        CompuServe id: 72467,2770
  443.