OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [stdalone/] [dactest/] [dactest.s] - Blame information for rev 232

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 232 hellwig
;
2
; dactest.s -- play samples
3
;
4
 
5
        .set    dba,0xF0500000          ; DAC base address
6
        .set    tos,0xC0020000          ; top of stack
7
 
8
        ; get some addresses listed in the load map
9
        .export start
10
        .export main
11
        .export out
12
 
13
        ; these labels are defined in the data file
14
        .import samples
15
        .import endsmpl
16
 
17
        ; minimal execution environment
18
start:
19
        add     $29,$0,tos               ; setup stack
20
        jal     main                    ; do useful work
21
start1:
22
        j       start1                  ; halt by looping
23
 
24
        ; main program
25
main:
26
        sub     $29,$29,12              ; create stack frame
27
        stw     $31,$29,0                ; save return register
28
        stw     $16,$29,4               ; save register variable
29
        stw     $17,$29,8               ; save register variable
30
        add     $16,$0,samples           ; pointer to samples
31
        add     $17,$0,endsmpl           ; pointer to end of samples
32
loop:
33
        ldw     $4,$16,0         ; get sample
34
        jal     out                     ; output to DAC
35
        add     $16,$16,4               ; bump pointer
36
        bne     $16,$17,loop            ; next sample
37
stop:
38
        ldw     $31,$29,0                ; restore return register
39
        ldw     $16,$29,4               ; restore register variable
40
        add     $29,$29,12              ; release stack frame
41
        jr      $31                     ; return
42
 
43
        ; output a sample (2 * 16 bit) to the DAC
44
out:
45
        add     $8,$0,dba                ; set I/O base address
46
out1:
47
        ldw     $9,$8,0                  ; get DAC status
48
        and     $9,$9,1                 ; value needed?
49
        beq     $9,$0,out1               ; no - wait
50
        stw     $4,$8,0                  ; send sample
51
        jr      $31                     ; return

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.