;----------------------------------------------------------------- ; EX62.ASM C.P. Diduch 2001 ; ; Continuously read input port IPORT and store into consecutive ; memory (in elements of array variable, X) and write to ; output port OPORT. ; ; Author(s): ; Signature(s): Date: ;----------------------------------------------------------------- .EQU IPORT 0 ; #define IPORT 0 .EQU OPORT 2 ; #define OPORT 2 ; .ORG 0x0000 ; "variable assignments in RAM" X: .DS 10 ; unsigned X[10] ; ; .ORG 0x8000 ; "assign the following to ROM" ; ; void main(void) { ; XOR R1, R1, R1 ; i = 0 ; // Reg. variable in R1. ; do { L0: LOADP R0, IPORT ; R0 = inport(IPORT) ; DSTOREM X(R1), R0 ; X[i] = R0 ; STOREP OPORT, R0 ; outport(OPORT, R0) ; ADDL R1, R1, 1 ; i = i + 1 ; JMP L0 ; } ; }