Motorola - An 68000 Assembly Program

An 68000 Assembly Program: "Hello World!"

ttl"Hello world program in Assembly Language"

;
;===================================================================
;Documentation Assignment on MOTOROLA by Alvin Pon
;Hey, don't blame me if this doesn't work! I can't test it!!
;
;This can be tested with DevPac 3 and DevPac Lite.
;
;Can I just warn you that this will run only on an
;Amiga - a machine that is not well known nowadays and
;something which I respect Motorola for.
;At least I can say I can multitask on an A1200 (14MHz)
;with 2Mb of RAM, Workbench 3.0 and AmigaDOS! {:-)
;A Pentium Pro (200Mhz) can boast about multitasking
;with 32Mb RAM and "essential", "efficient" Windows 95! {:-P
;So the only person I do not want to say "Hello!" to in
;this world is... you can take a stab in the dark...
;
;And before anyone even thinks of flaming me, I own a relatively
;powerful PC.  I spent a bomb upgrading it because it went out
;of date THREE months after I bought it: 8Mb RAM and multimedia
;became a "standard"! Oh sorry, this is supposed to be an assignment.
;Ah yes... the program...
;====================================================================
	section HelloWorld,code

;
ENTRY_POINT:	bra.s START		; Call start of program.
;
; ---- Embedded version string: ....
VERSION:   dc.b  0,"$VER: hello.asm 1.00 (11.1.97)",0
;
; ---- Include files ....
	incdir	"inc:"
	include	"exec/exec.i"
	include	"exec/funcdef.i"	; You may not need this.
	include	"exec/exec_lib.i"
	include "dos/dos.i"
	include	"dos/dos_lib.i"

;
; ---- Equates ....
_EXECBASE:	equ$04			;exec.library base.
;
; ---- Macro Definitions ....
SYS:	   macro
	move.1		_EXECBASE,a6
	jsr_LVO\1(a6)			; exec.library access macro
	endm

DOS:	   macro
	move.1		DosBase,a6
	jsr_LVO\1(a6)			; dos.library access macro
	endm
;
; ---- Main Program: ....
START:		leaDosName(pc),a1
	move.1	   #$00,d0		; We're not fussed which version
	SYSOpenLibrary
	move.1     d0,DosBase
	beqEXIT			; No dos, amazing.  Abort.
;
; ---- Find output channel for CLI/Shell window ....
	DOSOutput
;
; ---- Show our string ....
	move.1     d0,d1		; Set channel to shell/CLI
	leaOutputString(pc),a0
	move.1	   a0,d2
	move.1	   #OutputString_END-OutputString,d3
	DOSWrite
;
; ---- Close dos.library and exit ....
	move.1   DosBase,a1
	SYSCloseLibrary
;
; ---- Now quit this program ....
EXIT:	moveq #00,d0			; Exit program, no error.
       rts
;
; ---- Data for this program ....
DosBase: dc.1   0			;Space for dos library base
DosName: dcb.b  "dos.library",0		;Dos library name
;
OutputString:   dc.b  "Hello World!",10
OutputString_END;
;
; *** END OF PROGRAM ***

Back to main menu

A.T.Pon@cs.cf.ac.uk