Sonic and Sega Retro Message Board: M68K SANDBOX - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Loading News Feed...
 
Page 1 of 1

M68K SANDBOX Realize your ASM-dreams

#1 User is offline vladikcomper 

  Posted 04 November 2010 - 03:31 PM

  • Posts: 145
  • Joined: 13-June 09
  • Gender:Male
  • Location:Russia
  • Project:Sonic Winter Adventures
  • Wiki edits:1
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 your 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:

Syntax Highlighted Code: ASM
	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:



Yeah, you can preview source code in SANDBOX itself!
BCC didn't work? Try another value, experimenting! smile.png

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:



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

Syntax Highlighted Code: ASM
 
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:



Also, filling RAM example:




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: На ЦИСе выложу чуть позже, потерпите. =Ъ
This post has been edited by vladikcomper: 04 November 2010 - 05:35 PM

#2 User is offline Selbi 

Posted 04 November 2010 - 03:47 PM

  • Obligatory new year's avatar remake.
  • Posts: 1376
  • Joined: 12-May 08
  • Gender:Male
  • Location:Northern Germany
  • Project:Sonic ERaZor
  • Wiki edits:320
I had an awesome time testing this, most likley because it's just awesome. If you wouldn't already have that green banner, you would get it now.

On ICQ I said that "signed" and "trim" aren't good words to choose, so I'm asking the comunity: Are there words that would fit better?


Oh and I noticed a little issue about line breaks in the Code View:



How did I not see this the first time?
This post has been edited by Selbi: 04 November 2010 - 03:48 PM

#3 User is offline vladikcomper 

Posted 04 November 2010 - 03:51 PM

  • Posts: 145
  • Joined: 13-June 09
  • Gender:Male
  • Location:Russia
  • Project:Sonic Winter Adventures
  • Wiki edits:1
QUOTE (Selbi @ Nov 4 2010, 11:47 PM)
Oh and I noticed a little issue about line breaks in the Code View:



How did I not see this the first time?

Because in the version I gave you, code view didn't worked at all, having just static text instead. =P

Well, line breaks would be rather hard to do in ASM, though I'm planing to parse text before compilation, in fact I'm doing it even now, but its algorithm is very stupid.
This post has been edited by vladikcomper: 04 November 2010 - 03:52 PM

#4 User is offline NeKit 

Posted 04 November 2010 - 03:53 PM

  • Posts: 46
  • Joined: 19-September 08
  • Gender:Male
  • Location:Russia
  • Project:Sonic SCANF
  • Wiki edits:489
Unfortunately, I'm not a hacker, but still hope it will really make things for all easier.

I was really surprised at how "Code View" works. First I thought that it somehow dissassembles code at runtime, but really, as vladikcomper told, text representation is embedded during the build of ROM.

And here is another secret message, this time for author: Отличная работа!
This post has been edited by NeKit: 04 November 2010 - 03:55 PM

#5 User is offline vladikcomper 

Posted 05 November 2010 - 01:07 PM

  • Posts: 145
  • Joined: 13-June 09
  • Gender:Male
  • Location:Russia
  • Project:Sonic Winter Adventures
  • Wiki edits:1
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.
This post has been edited by vladikcomper: 05 November 2010 - 01:10 PM

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users