D-Bug & Automation Forum
D-Bug & Automation Forum >> Coding >> Bugaboo usage
https://d-bug.mooo.com/dbugforums/cgi-bin/yabb2/YaBB.pl?num=1179828064

Message started by ggn on 22.05.07 at 10:01:03

Title: Re: Bugaboo usage
Post by ggn on 22.05.07 at 11:40:32
A bit more on the Bugaboo screen


Line 3 of the Bugaboo screen writes the following:


Code (]  PC=200000 USP=3F7FF8 SSP=100000 SR=TS210XNZVC ori   #0,d0[/code):

Clicking on any of the 3 numbers in PC, USP, SSP takes the cursor there and lets you change the value on the spot. Clicking on any letter on the SR (except 'T') lets you toggle any bits on it. Handy eh? :)

Line 4 and 5 are like this:

[code]<- D0-D7 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
-> A0-A7 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000


As you expect, if you click on any of those numbers they can be changed.

But, what are the two arrows doing there? Well, this is a very nice feature (unique perhaps?) that in spite of a better name I'd like to call 'backtracing'. Let's say you traced thru a few commands and you suddendly realise that you wanted to see what d0 was 5 instructions ago. Oops! Usually this would mean restarting the trace from the beginning, which can get very tedious. But if you click on the left arrow then you can actually see the state of the PC and registers one instruction back! Bugaboo keeps quite some of those states (32?) and you have the added bonus that you can actually set that state to be the current! What this means is that you can reverse the trace! (of course the memory can't be altered back) What you need to do to achieve this is click on the "close box" character that appears on the 3rd line (on top of the arrows) when you go back some states. You can also do this by pushing alt+left or right buttons, and alt+insert to go back to a previous state.

Now that we covered a few things about the CLI, let's discuss a few more useful commands. First of all:

Loading stuff into memory


  • The easiest way to enter stuff into Bugaboo is to have Turbo Assembler assemble to the debugger memory! This way when you enter Bugaboo, you have your program ready to be traced, and the PC set up.

  • Another way is to load an executable or data file into memory. But first we need to learn to navigate through the directories using the CLI. When you type DIR at the cli, the directory is displayed in the following format:


    Code (]dir CODE\        ;0         11:15:30 20-02-2007 sub
    dir STUFF\      ;0         04:43:40 20-01-2003 sub
    lo  file1.ggn  ;.3358 17:56:11 11-01-2001
    lo  file2.ggn  ;.1000 13:56:11 11-01-2001
    le  exe1.prg   ;.5640 18:54:11 11-01-2001
    le  exe2.tos   ;.5640 11:56:11 11-01-2001[/code):



    I guess at this point most people that haven't read the previous text will switch off bugaboo :). But we know better, right? What you might have figured out reading this listing is that these are actulally commands generated to be executed by the CLI by navigating the cursor to the desired line, pressing Return and have the command executed.

    The same as before apply: everything after a ';' is discarded and is usually provided for your info, so we're left with much less stuff than is displayed. So, executing the 'dir' commands will actually change the directory path to the one selected and display the directory listing. The 'lo' command will load a binary file to the address of the PC. Finally the 'le' command will load the file as a gemdos relocatable file. Bugaboo makes the decision on whether to generate a 'le' or 'lo' command by the file's extension: 'tos', 'ttp', 'app' and 'prg' will generate 'le' by default. Of course if you know that a file is gemdos executable just change the 'lo' to 'le', press return and the file will be loaded as executable.

  • Lastly, you can read a sector from disk! The 'readsector' command is used for this. It's syntax is:

    [code]readsector <track>,<sector>,<side>,<address>

  • So, if you want to trace thru a boot demo/game/whatever you can put the disk in drive a and type:


    Code (]read ,1,,pc[/code):

    Then set supervisor mode on and start tracing :)


    Some more misc stuff on the CLI


    If you took a close look at the directory listing above, you must have noticed that after the comment the file's size, date and time is printed. On the file size you see that the number is prefixed by a '.'. This is because Bugaboo parses that as a decimal number. Not using a prefix on a number implies hexadecimal numbers, and a '%' implies binary numbers. Here are some examples:

    [code]? 1000+.256+%1;
    $1101 .4353 %1000100000001 "...."

    save testfile,^a0,^m0+^d0-100;
    Save TESTFILE from $100 to $3000 =.12032 Bytes.
    Do you want to save? (y/n)

    $200000>!move.w #^m0+^m1,d0;

    The first example evaluates that expression and prints the result using 3 different formats, for your convenience. The second writes the memory from where A0 points to where marker M0 plus D0 points minus $100. Lastly the third assembles that command to $200000, evaluating the expression and producing the result.

    Notice that I use ';' after each command. In practice you'll understand why! Also, as you see if you want to omit a parameter, just sikp it with a comma.

    Another handy hint (these posts are all about handy hints anyway :)): If you want to execute an instruction without having to assemble it to memory and tracing thru it you can use the '|'. So if you want to move the contents of $ff8240 to d0 (without having to actually produce a mem dump and a set) you can type:

    [code]|move.w $8240.w,d0;[/code]


    This will be executed on the spot.

D-Bug & Automation Forum » Powered by YaBB 2.6.0!
YaBB Forum Software © 2000-2022. All Rights Reserved.