MK68 SANDBOX Readme

SANDBOX is a utility, written in ASM, to test and debug your code, experimenting and even learning how M68K processor works. It's an enviroment with tools to see Registers and RAM space. You can write your ASM-code and then run in it SANDBOX, but here, besides normal ASM-comands, you'll have extra commands, like OUT, which can show the values of registers, bytes from RAM, ROM, almost everything. You'll also be able to pause your program at any point, write text strings and even more.

Usage

Place your programs in Proj folders, any ASM-files there will be included into SANDBOX after the compilation.

When the ROM is compiled, run it in any SMD Emulator. I'd recommend you Regen, because it's closest to the hardware, with it, you could learn to write a proper code, that will be the most compatible with the real hardware. After opening SANDBOX in emulator, select any program and run it. Controls are show in the bottom status bar.

Notes

Here some notes for you to avoid confuses in the future:

Commands

OUT [string]

Outputs constant string into console.

[string] - Any expression in quotes. Length is unlimited.

Examples:

	out	"I'm writing text in the console!"
	out	'Now the calculations will be done'

OUTx [data],[flags]

Outputs numeric value in the console.

[x] - data size, can be "w" (word), "b" (byte) and "l" (long). So, there are 3 comands: outb, outw and outl.
[data] - can be literally everything: d0, a0, (a0), 4(a5), ($FF0000).w or just constant #$1010.
[flags] - can have the following params:

You also can combine flags with "+" or "|" operators (I personally prefer +), so if you want the outputing number to be binary and trimmed, you may write: bin+trim.

Examples:

	move.b	#$FF,d0		; move $FF to d0
	outb	d0,signed	; display it as signed number
	
	outw	#$1010		; display in default mode: unsigned hex
	
	outl	#$-1000000,dec+signed	; this will display the number as signed decimal

BREAK

Moves cursor to the next row.

CLS

Clears the console.

PAUSE

Interrupts the program, and waits until you press C-button. During this period, you can switch to alternative modes in SANDBOX, like "RAM View" or "Registers".

Warning: Don't call this command from subprogram (when bsr/jsr was launched).

Examples:

	pause			; you can pause here
	bsr.s	Subprogram
	pause			; you can pause here
	rts
	
Subprogram:
	pause			; this will cause fatal error
	rts
; -----------------------
	moveq	#5,d0
Loop:	delay	10		; Cycle, not subprogram. You can delay it here!
	dbf	d0,Loop
; -----------------------
	move.w	d0,-(sp)	; move d0 into the stack
	pause			; ERROR!!!
	move.w	(sp)+,d0	; get d0 from the stack
	pause			; correct!

DELAY [frames]

Delays program for the amount of frames.

[frames] - is amount of frames. Note that 0 value here is not valid and will cause delaying for $FF frames.

Warning: Don't call this command from subprogram.