;
;	SYSC2001 Lab1
;	Printing ASCII Strings
;
;	Data for Main Pgm follows
;
Message: db 'Hello World!$'
;
;	This program calls a subroutine to print a text message
;
Start:
;	
	mov ax, Message		; addr of string in AX
	call PrtStr
	call PrtCR
	hlt			; done!
;
;	Data for PrtStr subroutine follows
;
Display	EQU 04E9h		; address of Virgo display
;
PrtStr:
;
;	Subroutine to print a string - addr is in AX
;	The string is delimited by a '$'
;	
	push dx
	push bx
	mov dx, Display
	mov bx,ax
GetCh:
	mov al,[bx]
	cmp al,'$'
	jz EndStr
	out [dx],al		; print the char
	inc bx
	jmp GetCh
;
EndStr:
	pop bx
	pop dx
	ret
;
PrtCR:
;
;	Subroutine to print a CR (carriage return) and LF (line feed)
;
	push dx	
	mov dx, Display
	mov al,0dh
	out [dx],al
	mov al,0ah
	out [dx],al
	pop dx
	ret
;
END	Start