;********************************************************************* ; ; ECEN4002/5002 DSP Lab Spring 2002 ; Example program: passio.asm ; ; Takes data from Debugger input file 16 words at a time, then ; loads them one by one into the A accumulator and calls user- ; supplied 'process_mono' function. Result in A accumulator is ; sent to Debugger output file. ; ; User provides lab2_io.asm include file containing 'my_init' ; and 'process_mono' subroutines and memory declarations. ; ; To enable data streams type from EVM30x Debugger COMMAND window: ; INPUT data_in -fra ;this will open input file for reading ; ; fractional (not exponent) data ; OUTPUT data_out -fra ;this will open output file for writing ; ; fractional data ; Do these Debugger commands BEFORE running the program. ; Remember to 'INPUT off' and 'OUTPUT off' at the end of the run. ; ;********************************************************************* nolist include 'ioequ.asm' list BLOCK EQU $10 ; number of words in file I/O INFILE EQU $10000 ; debugger: infile #1 handle OUTFILE EQU $10000 ; debugger: outfile #1 handle XMEM EQU $0001 ; debugger: x memory bit field YMEM EQU $0002 ; debugger: y memory bit field INDSP EQU $8000 ; debugger: input to dsp bit field OUTDSP EQU $4000 ; debugger: output from dsp bit field org x:0 inbuf ds BLOCK ; buffer for data in/out bufptr ds 1 ; temp storage for R register org p:$0000 ; Program block starts at zero jmp START ; Skip over interrupt vectors org p:$0100 START: movep #$040005,x:M_PCTL ; PLL 6 x 12.288 = 98.016MHz ori #3,mr ; mask interrupts movec #0,sp ; clear hardware stack pointer jmp DO_INIT ; Jump over user-supplied code include 'lab2_io.asm' ; User-supplied include file org p: DO_INIT jsr my_init ; Call user-supplied subroutine FILEIO: ;input data from PC move #inbuf,r0 ; start address to load data move #(INFILE|BLOCK),x0 ; BLOCK words from file INFILE move #(INDSP|XMEM),r1 ; X memory space, input direction debug ; invoke emulator service ; data now in x:inbuf (Debugger will generate breakpoint if error during read) do #BLOCK,endl move x:(r0),a ; move input data to A move r0,x:bufptr ; save R0 contents jsr process_mono ; Call user-supplied subroutine move x:bufptr,r0 ; restore R0 contents nop nop ; wait for pipeline nop move a,x:(r0)+ ; Transfer output data ; from A to mem (overwrite input) endl nop ; At this point, BLOCK input values have been processed and overwritten ; to x:inbuf. Ready to write to output file. ;output data to PC move #inbuf,r0 ; start address to xfer data move #(OUTFILE|BLOCK),x0 ; BLOCK words to file OUTFILE move #(OUTDSP|XMEM),r1 ; X memory space, output direction debug ; invoke emulator service nop ; Debugger will generate breakpoint ; if error during write jmp FILEIO ; Loop back and read next block. end