;----------------------------------------------------------------- ; EX63.ASM C.P. Diduch 2001 ; ; Read input port, IPORT, 5 times, and store into consecutive ; memory locations (elements of array, DATA[]). Also read each ; element of DATA[] 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" DATA: .DS 10 ; unsigned DATA[10] ; ; .ORG 0x8000 ; "assign the following to ROM" ; ; void main(void) { ; XOR R1, R1, R1 ; i = 0 ; // Reg. variable in R1. L0: SUBL NULL, R1, 5 ; while (i < 5) { JMPNC L1 ; LOADP R0, IPORT ; R0 = inport(IPORT) ; DSTOREM DATA(R1), R0 ; DATA[i] = R0 ; DLOADM R3, DATA(R1) ; R3 = DATA[i] ; STOREP OPORT, R3 ; outport(OPORT, R3) ; ADDL R1, R1, 1 ; i = i + 1 ; JMP L0 ; } ; } L1: JMP L1 ; do {} // End of program.