*************************************************
*						*
*     Program:	Port D Output			*
*						*
*     Name   :	portdo.src			*
*						*
*     Date   :	22 Jan 1999			*
*						*
*     By     :	Steven J. Dombrowski		*
*						*
*						*
*     This program outputs 6 bits on		*
* the M68HC11EVB and continuously updates all	*
* outputs.					*
*						*
*						*
*     To execute this program type G 6000 <CR>	*
*						*
*************************************************
*			      *
*  program origin and equates *
*			      *
*******************************
	 org $6000
outcrlf  equ $ffc4
outstrg0 equ $ffca
outa	 equ $ffb8
portd    equ $1008
ddrd     equ $1009
************************
*		       *
* Introductory message *
*		       *
************************
	ldaa #$1a		* clear screen
	jsr outa
	ldab #04		* skips 4 lines on
	jsr lines		*   the screen
	ldaa #26		* skips 26 spaces on
	jsr spaces		*    the screen
	ldx #line1		* prints program title
	jsr outstrg0		* message
	ldab #2 		* skips 2 lines on
	jsr lines		* the screen
	ldaa #29		* skips 29 spaces on
	jsr spaces		* the screen
	ldx #line2		* prints program
	jsr outstrg0		* message
	ldab #2 		* skips 2 lines on
	jsr lines		* the screen
	ldaa #27		* skips 27 spaces on
	jsr spaces		* the screen
	ldx #line3		* prints program
	jsr outstrg0		* message
	ldab #2 		* skips 2 lines on
	jsr lines		* the screen
	ldaa #24		* skips 24 spaces on
	jsr spaces		* the screen
	ldx #line4		* prints location
	jsr outstrg0		* message
	ldab #6 		* skips 6 lines on
	jsr lines		* the screen
************************
*		       *
* Main part of program *
*		       *
************************
	ldaa #$FF		*set bits 0-5 of
	staa ddrd		*portd as output
start	ldaa #$FE
	staa portd
	jsr  delay 	
	ldaa #$FD
	staa portd
	jsr  delay
	ldaa #$FB
	staa portd
	jsr  delay
	ldaa #$F7
	staa portd
	jsr  delay
	ldaa #$EF
	staa portd
	jsr  delay
	ldaa #$DF
	staa portd
	jsr  delay
	jmp start	* continue program
***********************************
*				  *
*  Subroutine to backspace cursor *
*				  *
***********************************
bkspc	ldy #$40
bkspc1 ldaa #$08
	jsr outa
	dey
	cpy #0
	bne bkspc1
	rts
*******************************
*			      *
* Subroutine to delay 1/2 sec *
*			      *
*******************************
delay	ldy #2
dly	ldx #$e000
dly1	dex
	cpx #0
	bne dly1
	dey
	cpy #0
	bne dly
	rts
******************************************
*					 *
* Subroutine to skip lines on the screen *
*					 *
******************************************
lines	  jsr outcrlf
	  decb
	  cmpb #0
	  bne lines
	  rts
*******************************************
*					  *
* Subroutine to skip spaces on the screen *
*					  *
*******************************************
spaces	  tab
	  ldaa #$20
spaces2   jsr outa
	  decb
	  cmpb #0
	  bne spaces2
	  rts
******************************************************
*						     *
*		   Screen messages		     *
*						     *
******************************************************
line1  fcc '   Port D Output Program'
       fcb 4
line2  fcc 'using the M68HC11EVB'
       fcb 4
line3  fcc 'by Steven J. Dombrowski'
       fcb 4
line4  fcc 'Rensselaer Polytechnic Institute'
       fcb 4
