First Steps

Writing and Assembling Programs

To illustrate ColdFire Studio let's write first program. Copy and paste below code into ColdFire Studio editor window and save it under any name.

	; code location
	*= $10000

Start:
	; clear terminal window
	move.w #1, -(sp)
	trap #15
	addq.l #2, sp

	; print message
	lea (.msg, pc), a0
	move.w #4, -(s0)
	trap #15
	addq.l #2, sp

	; terminate
	clr.w -(sp)
	trap #15

.msg:
	dc.b "Hello World.", 10, 0
	align

	; execute simulation from 'Start' label
	end Start

Press Alt+A (Simulator/Assemble and Debug) to compile sample program. As written it contains an error in line 12. Red marker will be placed in this line and status at the bottom of the screen will say "Address register expected". This is how errors are reported. Correct it by changing s0 to sp. Press Alt+A again. This time assembly should succeed. Yellow marker will show up in line 6. It shows current instruction to be executed.

Note: To check program syntax without entering debugger press Alt+C (Simulator/Check Document).

Debugging

As soon as program is assembled without errors it is ready to run. Following commands found under 'Simulator' menu are used to run and debug code:

Binary Code

Assembled code can be saved (File/Save Code), and loaded (File/Load Code). Supported formats include Intel Hex and Motorola S-Record.