		ttl	"Hello world program in Assembly Language"
;
; ==========================
; Amiga Shopper Assembly Language Course, Part IV:
;
; The great HELLO WORLD program!
; Tested with DevPac 3 and DevPac Lite.
;
		section	HelloWorld,code
;
ENTRY_POINT:	bra.s	START			; Call start of program.
;
; ---- Embedded version string: ....
VERSION:	dc.b	0,"$VER: hello.asm 1.00 (6.11.94)",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.l	_EXECBASE,a6
		jsr	_LVO\1(a6)		; exec.library access macro
		endm

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