home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_10 / DEVELOP.LZH / DSP / DSPDEBUG / DOC / DOC.TXT next >
Text File  |  1992-11-21  |  18KB  |  549 lines

  1.  
  2. Documentation of the ATARI DSP56001 Debugger v1.0 (10/02/92).
  3. Updated for 1.01 (11/21/92)
  4.  
  5. General Interface Overview:
  6. There are two types of windows, the list windows and the action windows.
  7. The list type is used to display:
  8. registers, disassembly, memory, stack, breakpoints and variables.
  9. The action type is used to:
  10. load to memory, set preferences, copy memory, fill memory,
  11. send file, receive file,
  12. evaluate expression, set or edit breakpoint, lock window, goto address/memory
  13. find word and replace word.
  14. A list window can be closed, moved, resized and fulled as the usual way.
  15. An action window can be closed and moved as the latter. The fuller button
  16. is used to reset the window to its old position. The close button acts
  17. always as a Cancel button. The default button can be selected with the
  18. Return key, in wich case the action is done, and the window remains opened. If
  19. the Enter key is pressed, then the action is done and the window is closed.
  20. The same features can be done with the mouse: a single click is equivalent
  21. to the Return key, and a double-click to the Enter key.
  22. If there are other buttons in the window, some are radio-buttons, some are
  23. check buttons and some are other action buttons. They never close the window.
  24.  
  25. Almost all editable textfields in action windows do scroll. All those fields 
  26. accept regular expression for evaluation (see The Evaluator for regular 
  27. expression syntax).
  28.  
  29. All the debugger functions are accessible through entries in menus.
  30. You will find the functions description below. At one time,
  31. some menu entries can be disabled because they make no sense in the current 
  32. context.
  33.  
  34. Mainly, when the program is running, all context actions (except Halt):
  35. Trace Into,
  36. Trace Over,
  37. Skip,
  38. Run
  39. are disabled. The Halt and Host Command functions are selectable.
  40. When the program is stopped, the first four entries are selectable, and
  41. the last two are disabled.
  42.  
  43. Deeper in Debugging Techniques:
  44. If you use the linker to output the LOD file, you will get the symbols
  45. automatically. Otherwise, if you use the assembler directly, use
  46. asm56000 -a -b source.asm and the cldtolod utility.
  47. Variable names are generated up to 20 characters.
  48. You cannot halt the DSP if the debugged program IPL is higher than 2.
  49. You have no need to change the default IPL level (2), anyway. Note that
  50. you can freely be in IPL0, IPL1 or IPL2 as the debugger polls to communicate
  51. with its remote part. By the way, you should start your program by
  52. setting the HCIE bit of HCR (DSPDebug forces it anyway).
  53. You cannot predefine code between:
  54. P:2 to P:7,            Stack Error, Trace Exception, SWI Exception
  55. P:$1e to P:$1f,        NMI exception
  56. P:$3e to P:$3f,        Illegal exception
  57. P:$7e00 to $7eff,    Remote part of DSPDebug
  58. X:$ffff to X:ffff    DSP ISR
  59.  
  60. Your program shouldn't use the previous vectors for any purpose when debugging.
  61. For the moment, DSPDebug doesn't check for those addresses when copying,
  62. filling, loading to memory, setting memory by the evaluator ...
  63. Changing HCR during program execution is left to the programmer's
  64. responsibility, except for bits HF2 and HF3. The HCR Host Flags configuration
  65. HF2=1 and HF3=1 are used by the debugger to communicate with its remote part, 
  66. as well as the HSR Host Flags configuration HF0=1 and HF1=1.
  67. Same thing for the OMR bits 0 and 1, which enable the Host Interface.
  68. Remember that the remote debugger uses one stack level when called by the
  69. DSP to handle an exception, or if asked for a Host Interrupt. If there is
  70. no space on the stack for the exception, a Stack Error exception will occur,
  71. and the stack will be reinitialised. This is a difference between running
  72. under the DSP driver and the DSP Debugger, as you have one stack level less.
  73. You can use SWI in your program in order to stop it at some point, in the
  74. same way as the illegal 680x0 instruction. But note that since the SWI 
  75. exception has a lower priority than the Trace exception, the DSP CPU will 
  76. ignore a SWI instruction during a Step Into command.
  77.  
  78. Software functions description:
  79. DSPDebug menu:
  80.     Informations
  81. Display interesting things as well as the current free memory. The latter
  82. is real time updated and displayed in the window.
  83.  
  84. File menu:
  85.  
  86.     Open LOD
  87. Load a LOD file from disk and upload it in the DSP.
  88. The program start address can be set to any address, using the END
  89. statement in the assembler.
  90.  
  91. ex:
  92.     ORG    p:0
  93. Start:    jmp    Main    ;you MUST begin in 0 if you want to be launched
  94.             ;by the DSP driver functions DspExec...
  95.             ;DSPDebug allows starting from anywhere wich is
  96.             ;not a restricted area
  97.     ORG    P:$10
  98.     nop
  99.     nop
  100.  
  101.     ORG    P:$200
  102. Main:    nop
  103.     nop
  104.     ...
  105.  
  106.     END    Start
  107.  
  108. The line 'END Start' tells the debugger that the program start address
  109. is the Main function. The default start address of a LOD file is,
  110. of course, the lowest address. For more information about the LOD 
  111. format, read the MOTOROLA DSP Assembler documentation. The debugger
  112. handles P, X, and Y initialized and non-initialized datas.
  113.  
  114. Warnings:
  115.     "Warning. No _END directive before EOF",
  116.     "Warning. No _DATA directive before EOF",
  117.     "Warning. Tab used",
  118.  
  119. Error messages:
  120.     "File is empty",
  121. File has a zero length.
  122.     "No _START directive",
  123. File has no "_START" directive, and so is not likely to be a LOD file.
  124.     "Unknown RAM specification",
  125. A RAM specification different from P, X, Y and L is used.
  126.     "Bad number format",
  127. A number which is not of the form FFFF (hexadecimal radix) is used.
  128.     "Bad number size",
  129. A number that exceeds a word size (24 bits) is used.
  130.     "Bad line size",
  131. A line containing more than 10 words is used.
  132.     "Memory access violation",
  133. The program uses vectors which are reserved by the debugger.
  134.     "Invalid RAM address",
  135. A RAM address exceeding the preferences sizes is defined.
  136.     "Invalid block size",
  137. A block size exceeding the preferences sizes is defined.
  138.     "Space or tab expected",
  139. Couldn't find a valid separator.
  140.  
  141.     Restart LOD
  142. Reloads and restarts the currently debugged LOD program.
  143.  
  144.     Load ASM
  145. Load an ascii file in a window. This is mainly used to load the source
  146. of the current LOD program.
  147.  
  148.     Load to memory
  149. Load a file in memory. This allows to load a file into the DSP memory.
  150.  
  151.     Save from memory
  152. Save a file from memory. This allows to dump part of the DSP memory.
  153. If the file already exists and the expert mode is not set, you will be
  154. warned before overwriting the previous file.
  155.  
  156.     Preferences
  157. Indicates the available P, X and Y ram sizes on the DSP. They are used in
  158. memory windows, and for the search loop.
  159.  
  160. Autosave windows. Automatically save current windows configuration at 
  161. quit time.
  162.  
  163. Autoload windows. Automatically load DEFAULT.DSK windows configuration at 
  164. launch time.
  165.  
  166. Set expert mode. Skip one-way alerts and less important warnings:
  167. - when quitting the program:
  168.     "Do you really want to quit?"
  169. - when loading a LOD file:
  170.     "Warning. No _END directive before EOF",
  171.     "Warning. No _DATA directive before EOF",
  172.     "Warning. Tabs used.",
  173. - when deleting a breakpoint:
  174.     "Delete breakpoint ?"
  175. - when saving to disk
  176.     "File already exists. Overwrite ?"
  177.  
  178. Tab size is used in disassembly and source windows.
  179.  
  180. Set in-line help mode. The options which are described in the in-line help
  181. are indicated by changing the mouse cursor to a magnifier. In-line help
  182. texts are displayed at the bottom of the screen.
  183.  
  184. Set update mode. (not implemented).
  185.  
  186.     Save desktop
  187. Save current windows configuration.
  188.  
  189.     Load desktop
  190. Load a windows configuration.
  191.  
  192.     Print top window
  193. Prints the top window to ASCII file.
  194.  
  195.     Quit
  196. Exit the DSP Debugger
  197.  
  198.  
  199.  
  200. Edit menu:
  201.  
  202.     Copy memory
  203. Copy memory. It manages overlapping memory blocks.
  204.  
  205.     Fill memory
  206. Fill memory. "Increment" is added to fill value at each loop.
  207.  
  208.     Modify
  209. Modify breakpoint settings.
  210. If running, the changes will occur at the next context switching.
  211.  
  212.     Kill
  213. Delete breakpoint
  214. If running, the changes will occur at the next context switching.
  215.  
  216.     Kill all
  217. Delete all breakpoints
  218. If running, the changes will occur at the next context switching.
  219.  
  220.  
  221.  
  222. Context menu:
  223.  
  224.     Trace into
  225. Single steps current instruction.
  226. When running, this option is disabled. Use Halt to break program execution.
  227.  
  228.     Trace over
  229. Sets a breakpoint on the next instruction, and run. Useful for JMP, JScc or
  230. DO LOOP.
  231. When running, this option is disabled. Use Halt to break program execution.
  232.  
  233.     Skip
  234. Skips the current instruction (sets the PC to the next instruction).
  235. When running, this option is disabled. Use Halt to break program execution.
  236.  
  237.     Run
  238. Starts program execution from the current instruction.
  239. When running, this option is disabled. Use Halt to break program execution.
  240.  
  241.     Halt
  242. Halts the program with a NMI exception.
  243. If not running, this option is disabled.
  244.  
  245.     Send Host Command
  246. Requests the given interrupt vector.
  247. If not running, this option is disabled.
  248.  
  249.     DSP Reset
  250. Hardware reset of the DSP.
  251. Whether the program is running or not, it hardly resets the DSP and reuploads
  252. the remote debugger part. It restores software and hardware registers.
  253.  
  254.     Send
  255. Sends a binary words file to the DSP (by the host port).
  256. Data can be 1 word = 3 bytes or 1 word = 4 bytes.
  257.  
  258.     Receive
  259. Stores all words sent by the running program (by the host port).
  260. Data can be truncated or padded to any byte(s) per word combination.
  261.  
  262. Actions menu:
  263.  
  264.     Evaluate exp.
  265. Evaluates a regular expression, display the result in hexadecimal, decimal
  266. and fractional form. See the Evaluator appendice for details on regular
  267. expression syntax.
  268.  
  269.     Goto
  270. Goto an address/ram on disassembly and memory windows
  271.     
  272.     Lock window
  273. Lock a disassembly or memory window address with an expression/ram.
  274. To unlock the window, enter an empty expression.
  275.  
  276.     Set break
  277. Set a breakpoint with the following parameters:
  278. - address:    where the breakpoint will be set in P ram.
  279. - count:    decremented at each breakpoint hit. The
  280.         context is rerun if count!=0.
  281. - expression:    evaluated at each breakpoint hit. The
  282.         context is rerun if the evaluation doesn't return true (1L).
  283.  
  284.     Search
  285. Search for word value in memory.
  286. Loop through the specified ram and from the specified address, searching
  287. the "what" word value. If it reaches the top of the memory (as indicated in
  288. the preferences), it restarts from the beginning. It stops when the search
  289. start address is reached.
  290.  
  291.     Replace            (NOT FINISHED)
  292. Search for word value in memory and replace with another
  293.  
  294. Windows menu:
  295.  
  296.     Registers
  297. Displays DSP 56001 registers. Please refer to the Help or DSP Manual.
  298.     
  299.     Disassembly
  300. Displays P ram in assembly code.
  301. Line format:(between [] means optional)
  302. [Check]<address><space>[pc marker]<opcode><[operand]<tab>[operand]...>[Cond]
  303.  
  304. - [Check] sign ( or $8)
  305. indicates a breakpoint at this address.
  306. One can double-click on the sign in order to edit the breakpoint.
  307. It is also possible to remove it by clicking on the sign, or set one by 
  308. clicking on the space.
  309. If you double-click on a space, a breakpoint will be created at this address
  310. and a breakpoint edit window will open.
  311.  
  312. - <address>
  313. is the disassembly line address in P ram (16 bits).
  314. If there is a label at this address, its name will be displayed on one line,
  315. with the disassembly line following.
  316. If there is more than one label, they will all be displayed in the same way.
  317.  
  318. - <space>
  319. is only a separator.
  320.  
  321. - [pc marker]
  322. indicates if the PC register points to this line of code.
  323. It can be:
  324.     - (Up arrow), instruction branches upward.
  325.     - (Down arrow), instruction branches downward.
  326.     - (Right arrow), instruction is not a branch instruction.
  327.     -? (Question mark), instruction branches on memory value.
  328. Memory is not tested to avoid disturbing I/O processing.
  329.  
  330. - <opcode>
  331. is the instruction opcode.
  332. Help on it is available in-line or by double-clicking on it.
  333.  
  334. - <tab>
  335. allows the alignement of same types of data
  336. The tab value is set in the preferences.
  337.  
  338. - [operand]
  339. is one of the instruction's operand.
  340. If it contains an I/O register (X:$ffe? or X:$fff?), its name is printed 
  341. instead of its value, according to the following table:
  342.  
  343. PBC    is    $ffe0    ;Port B Control register
  344. PCC    is    $ffe1    ;Port C Control register
  345. PBDDR    is    $ffe2    ;Port B Data Direction Register
  346. PCDDR    is    $ffe3    ;Port C Data Direction Register
  347. PBD    is    $ffe4    ;Port B Data register
  348. PCD    is    $ffe5    ;Port C Data register
  349. HCR    is    $ffe8    ;Host Control Register
  350. HSR    is    $ffe9    ;Host Status Register
  351. CRA    is    $ffec    ;SSI Control Register A
  352. CRB    is    $ffed    ;SSI Control Register B
  353. SSISR    is    $ffee    ;SSI Status Register
  354. SSITSR    is    $ffee    ;SSI Time Slot Register
  355. RX    is    $ffef    ;SSI Serial Receive data/shift register
  356. TX    is    $ffef    ;SSI Serial Transmit data/shift register
  357. SCR    is    $fff0    ;SCI Control Register
  358. SSR    is    $fff1    ;SCI Status Register
  359. SCCR    is    $fff2    ;SCI Clock Control Register
  360. STXA    is    $fff3    ;SCI Transmit data Address Register
  361. SRX    is    $fff4    ;SCI Receive data register (4-5-6)
  362. STX    is    $fff4    ;SCI Transmit data register (4-5-6)
  363. BCR    is    $fffe    ;Port A Bus Control Register
  364. IPR    is    $ffff    ;Interrupt Priority Register
  365. You can double-click on one to get the help information on it.
  366.  
  367. - [expr]    the breakpoint expression set at this address, if any.
  368.  
  369. Note:
  370. the end of loop address of a DO LOOP instruction is incremented by 1
  371. in the display, to allow the symbol address matching.
  372.  
  373. Buttons:
  374.     I:    Trace Into
  375.     O:    Trace Over
  376.     S:    Skip
  377.     R:    Run
  378.     PC:    If selected, locks the window with the PC
  379.     
  380.     Memory
  381. Displays P, X, Y, or L ram in hexadecimal or fractional base.
  382. (You can't use fractional base in L ram.)
  383. Buttons:
  384.     P:    Selects P ram
  385.     X:    Selects X ram
  386.     Y:    Selects Y ram
  387.     L:    Selects L ram
  388.     H:    Displays in hexadecimal radix
  389.     F:    Displays in fractional form
  390.     
  391.     Stack
  392. Displays the 15 SSH and SSL. The current level of the stack is
  393. indicated by an horizontal line. That means the initialized stack
  394. is from SSH1-SSL1 to the horizontal line.
  395.     
  396.     Breakpoints
  397. Displays the breakpoints list. You can scroll the cursor, and double-click
  398. or press return on one to change its settings.
  399.  
  400.     Variables
  401. Displays the variables list. You can scroll the cursor, and double-click
  402. or press return on one to go directly to the variable address.
  403. The display is alphabetical.
  404.  
  405.     Host regs
  406. Edit DSP Host registers
  407. If running, the changes will occur at the next context switching.
  408.  
  409.     SSI regs
  410. Edit DSP SSI registers
  411. If running, the changes will occur at the next context switching.
  412.  
  413.     Close window
  414. Closes current window.
  415.  
  416.     Cycle window
  417. Cycles through the program windows list.
  418.  
  419. Help menu:
  420.  
  421.     Index
  422.     Back
  423.     Registers
  424.     Assembly
  425.     Host
  426.     SSI
  427.     User
  428.  
  429. The Help modes:
  430. There are two kinds of help:
  431. -the in-line help, which is displayed at the bottom of the screen if the
  432. In-line Help flag is set in the preferences. This help mode provides
  433. on line upon each menu title and entry, each active object in action 
  434. windows, and each window button. It also gives a short definition for
  435. software and hardware registers, and for instructions.
  436.  
  437. -the window help, which provides a full explanation upon the topic 
  438. chosen by a single click on a bold word (in registers, disassembly 
  439. and help windows).
  440.  
  441. The Evaluator:
  442.  
  443. -variables:
  444.     A variable name cannot begin with a digit. It can only include
  445.     characters, digits and underscores(_). If you want to use the
  446.     content of a variable instead of its value, you must preceed it
  447.     with the indirection operator '*'.
  448.         ex: *dummy= $4
  449.     The evaluation is always case-dependent.
  450.  
  451. -constants:
  452.     They are coded on 32 or 64 bits. They can be written in decimal
  453.     (ex: 123), in hexadecimal (ex: $1FC3), in binary (ex:%101) or
  454.     fractional (ex: .123, 100e-3).
  455.  
  456. -registers:
  457.     Every register used in DSP addressing modes can be written.
  458.     ex: ( A, AB, A10, MR, SR, A2, etc...)
  459.  
  460. -adresses:
  461.     Access to a memory location is made in a 56001 syntax:
  462.     X:$1234 accesses to X ram at location $1234.
  463.  
  464. -operators:
  465.     - Add:            +
  466.     - Substract:        -
  467.     - Multiply:        *
  468.     - Divide:        /
  469.     - Rest (modulo):    %
  470.     - And bit to bit:    & (This operator can't be used with fractional)
  471.     - Inclusive Or:        | (This operator can't be used with fractional)
  472.     - Exclusive Or:        ^ (This operator can't be used with fractional)
  473.     - Not bit to bit:    ~ (This operator can't be used with fractional)
  474.     - Right shift:        >> (This operator can't be used with fractional)
  475.     - Left shift:        << (This operator can't be used with fractional)
  476.     - Logical Not:        !
  477.     - Logical Or:        ||
  478.     - Logical And:        &&
  479.     - Equal:        ==
  480.     - Not Equal:        !=
  481.     - Higher:        >
  482.     - Lower:        <
  483.     - Higher or Equal:    >=
  484.     - Lower or Equal:    <=
  485.     - Set:            =
  486.         the left operand must be a variable, an address or a register.
  487.         ex: (dummy = 3, x:$200 = 45, PC = $41, x:(r0 + 10) = $DEAD)
  488.         In that case, the variable doesn't need the indirection
  489.         operator (its content will be set automatically).
  490.     - Unary Plus:        +
  491.     - Unary Minus:        -
  492.     - Indirection:        *
  493.     - Block start:        (
  494.     - Block end:        )
  495.  
  496. -error messages:
  497.     "Bad expression syntax",
  498.     "No more memory",
  499.     "Incomplete expression",
  500.     "Constant overflow",
  501.     "Address overflow",
  502.     "Unknown label",
  503.     "Incompatible operator",
  504.     "Fractional overflow",
  505.     "Divide by zero",
  506.     "L-value required",
  507.     "Not implemented"
  508.  
  509. How to communicate with the DSP Debugger:
  510. As shown in the source example contained in the MSGEX folder, an accessory
  511. (or a program, under MultiTOS) can receive the DSP data from the Host Port
  512. via the debugger and gem-pipe messages. Here is the method to do so:
  513.  
  514. #define    DSPDEBUG_MESAG    127
  515.  
  516. typedef enum {
  517.     START_RECEIVE=0,
  518.     END_RECEIVE=1
  519. } DSPDEBUG_CMD;
  520.  
  521. /* appl_find the DSP Debugger: (for instance at program start) */
  522.     DSP_DebugId=appl_find("DSPDEBUG");
  523.  
  524. /* appl_write to the DSP Debugger that you are ready to receive: */
  525.     msg[0]=DSPDEBUG_MESAG;
  526.     msg[1]=DSP_DebugId;
  527.     msg[2]=0;
  528.     msg[3]=START_RECEIVE;
  529.     appl_write(DSP_DebugId,16,msg);
  530. /*
  531. and then through the event loop, check for a DSPDEBUG_MESAG message et get
  532. the word from the pipe:
  533. */
  534.     if (evnt&EVNT_MESAG) {
  535.         if (msg[0]==DSPDEBUG_MESAG) {
  536.             DSP_word=((long)(msg[3])<<16)+msg[4];
  537.             /* do stuff with it ... */
  538.         }
  539.     }
  540. /* when you want to finish the pipe: (for instance at program end) */
  541.     msg[0]=DSPDEBUG_MESAG;
  542.     msg[1]=DSP_DebugId;
  543.     msg[2]=0;
  544.     msg[3]=END_RECEIVE;
  545.     appl_write(DSP_DebugId,16,msg);
  546.  
  547.     Brainstorm
  548.  
  549.