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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [binutils/] [tests-2/] [hello/] [hello.s] - Blame information for rev 198

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 hellwig
;
2
; hello.s -- Hello, world!
3
;
4
 
5
; $11  I/O base address
6
; $12  temporary value
7
; $13  character
8
; $14  pointer to string
9
; $29 stack pointer
10
; $31 return address
11
 
12
        .set    tba,0xF0300000
13
 
14
reset:  add     $29,$0,0xC0010000
15
        jal     start
16
reset1: j       reset1
17
 
18
start:  sub     $29,$29,4       ; save return register
19
        stw     $31,$29,0
20
        add     $11,$0,tba       ; set I/O base address
21
        add     $14,$0,hello     ; pointer to string
22
        or      $14,$14,hello
23
loop:   ldbu    $13,$14,0        ; get char
24
        beq     $13,$0,stop      ; null - finished
25
        jal     out             ; output char
26
        add     $14,$14,1       ; bump pointer
27
        j       loop            ; next char
28
stop:   ldw     $31,$29,0        ; restore return register
29
        add     $29,$29,4
30
        jr      $31             ; return
31
 
32
out:    ldw     $12,$11,8       ; get status
33
        and     $12,$12,1       ; xmtr ready?
34
        beq     $12,$0,out       ; no - wait
35
        stw     $13,$11,12      ; send char
36
        jr      $31             ; return
37
 
38
hello:  .byte   "Hello, world!"
39
        .byte   0x0D, 0x0A, 0

powered by: WebSVN 2.1.0

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