M68K SANDBOX

Discussion in 'Utilities' started by vladikcomper, Nov 4, 2010.

Thread Status:
Not open for further replies.
  1. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    When you coding some stuff for your hack, the debugging process can be absolutely awful. You aren't able to see the result of instructions in the code, generally having just to guess where the mistake is and trying to fix it with trial and error method. If you code is big, it's a real headache. Even being able to see RAM, VRAM, you can't control everything, for example, you can't be sure, if some part of your code works or not, if branch command branch or didn't work because of some issues.


    So I've got a mad idea of creating a tool, that could make debugging process easier, basically, thought the ability to show the result of operations. But eventually, I went deeper, and created... SANDBOX!


    SANDBOX is my first program for Sega Genesis, it's a powerful tool to test and debug your code, which even can be used to learn assembly language and how M68k processor works.


    The idea is very simple - you write ASM-code, include it into SANDBOX (including process is automatized), run it in emulator and SANDBOX will provide you abilities to see RAM space, registers etc. But the main thing here is... extra commands!

    (actually macros)


    There is OUT command to output any kind of data, PAUSE command to pause program at any point and some others.


    Let's have a real example.


    Imagine that you don't know, what BCC does, and want to figure this out, so you can write a program:



    move.w #$10,d0
    cmpi.w #$20,d0


    bcc.s BCCWorks


    out "BCC didn't work!"


    rts


    BCCWorks:


    out 'BCC worked!'


    rts



    And when you compile and run it in SANDBOX, you'll see the result:


    [​IMG][​IMG]


    Yeah, you can preview source code in SANDBOX itself!


    BCC didn't work? Try another value, experimenting! :)


    There are some sample programs, that will learn you how to do some useful things about your code (and yes, BCC example is there, but more completed and advanced, so you might wanna check it out)


    You just put ASM-files in a specific folder, and any files there will be compiled and included into SANDBOX, letting you run several programs:


    [​IMG]


    I guess just outputting text isn't enough for good debugging, so there are commands to output numeric values, example:




    move.b #$F0,d0 ; let's put $F0 to d0 and see it in different modes!


    outb d0 ; see as Unsigned Hexadecimal


    break


    outb d0,signed ; see as Signed Hexadecimal


    break


    outb d0,dec ; see as Unsigned Decimal


    break


    outb d0,dec+signed ; see as Signed Decimal


    break


    outb d0,bin ; see as Unsigned Binary


    break


    outb d0,bin+signed ; see as Signed Binary


    pause


    move.w #$1020,d0


    outw d0 ; see as Unsigned Hexadecimal word


    break


    outw d0,signed ; see as Signed Hexadecimal word


    break


    outb d0 ; see as byte


    pause


    move.l #-$1,d0


    outl d0 ; see as unsigned


    break


    outl d0,signed ; see as signed


    break


    outl d0,trim+signed ; see as signed with triming!


    rts



    Result of running it:


    [​IMG]


    Also, filling RAM example:


    [​IMG][​IMG]


    SANDBOX now is in beta state, there can be some bugs, Source code viewing doesn't work properly. If you notice any unexpected crashes, glitches, please report.


    Don't forget to read readme.htm.


    Download


    Secret message for Russian hackers: На ЦИСе выложу чуть позже, потерпите. =Ъ
     
  2. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    Hm, not bad. But wouldn't be better if the program tell us what function to use instead of just say that the line is wrong?
     
  3. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    It doesn't tell if the line is wrong. What do you mean in "what function to use"? I can't get you. o_O


    The idea of it is just to run code from ASM-files, but you can have extra commands in the code, like OUT to show any data on screen, PAUSE to interrupt running your code at any point. SANDBOX itself just runs your code, it has no idea where the mistake or what to do if the error happened. But if you command PAUSE in your code, it will stop program, if you command OUT "Some text", it will display "Some text" on the screen.


    Well, I've explained as good as I could. If you can't understand my poor English somewhere, please tell me, I'll try to explain again.


    -------------------


    Also, a very little update (actually done some hours ago):


    - Fixed few misprints in readme.htm, but some grammar there is bad I think, and unfortunately I can't fix due to my poor English.


    I would appreciate any help in fixing text in this file.


    - Russian version of readme.htm added.


    - Build.bat fixed a bit. I've forgot to remove the line that copies ROM-file to folder with my Sega emulator. Now it's commented out.


    By the way, you can uncomment it (delete "rem") and replace path in quotes with your own path. It's very useful in case you like to keep yous ROMs in a single folder.


    Download link is the same.
     
Thread Status:
Not open for further replies.