; EX55.ASM      C.P. Diduch 2001
;
; Assembly Line Formats Example
;
;    Author(s):
; Signature(s):                              Date:
;-----------------------------------------------------------------

	.ORG	0x0000          ; Begin assembly at 0x0000.
.EQU   	PORT    0x001C          ; PORT is alias for 0x001C.
        .DS     10              ; Reserve 10 words of mem.
TOS:    .DS     1               ; Declare (reserve) 1 word of
				; memory as variable TOS.
                                ;
      	.ORG	0x8000          ; Begin assembly at 0x8000.
X:      .DW     10, 0xF         ; Declare (reserve) 4 words in
      	.DW     'D', 0          ; memory as array X with 
  				; initial value {10, 15, 'D', 0}.
				;
M0:     XOR#    R0, R0, R0      ; do { i = i ^ i ;
        ADDL    R2, NULL, TOS   ;    ptr = &TOS ;
 	DSTOREM (R2), R0        ;    *ptr = i ;
M1:     DLOADM   R1, X(R0)      ;    do { z = X(i) ;   
	STOREP  PORT, R1       	;         outport(PORT, z)
                                ;
	ADDL# 	R0, R0, 1      	;         i = i + 1 ;
	SUBL   	NULL, R0, 4    	;         }
	JMPNZ  	M1             	;    while ( i != 4)
	JMP     M0             	;    }
