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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [sim/] [testsuite/] [sim/] [arm/] [hello.ms] - Blame information for rev 856

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

Line No. Rev Author Line
1 24 jeremybenn
# output(): Hello, world.\n
2
# mach(): all
3
 
4
# Emit hello world while switching back and forth between arm/thumb.
5
# ??? Unfinished
6
 
7
        .macro invalid
8
# This is "undefined" but it's not properly decoded yet.
9
        .word 0x07ffffff
10
# This is stc which isn't recognized yet.
11
        stc 0,cr0,[r0]
12
        .endm
13
 
14
        .global _start
15
_start:
16
# Run some simple insns to confirm the engine is at least working.
17
        nop
18
 
19
# Skip over output text.
20
 
21
        bl skip_output
22
 
23
hello_text:
24
        .asciz "Hello, world.\n"
25
 
26
        .p2align 2
27
skip_output:
28
 
29
# Prime loop.
30
 
31
        mov r4, r14
32
 
33
output_next:
34
 
35
# Switch arm->thumb to output next chacter.
36
# At this point r4 must point to the next character to output.
37
 
38
        adr r0, into_thumb + 1
39
        bx r0
40
 
41
into_thumb:
42
        .thumb
43
 
44
# Output a character.
45
 
46
        mov r0,#3 @ writec angel call
47
        mov r1,r4
48
        swi 0xab @ ??? Confirm number.
49
 
50
# Switch thumb->arm.
51
 
52
        adr r5, back_to_arm
53
        bx r5
54
 
55
        .p2align 2
56
back_to_arm:
57
        .arm
58
 
59
# Load next character, see if done.
60
 
61
        add r4,r4,#1
62
        sub r3,r3,r3
63
        ldrb r5,[r4,r3]
64
        teq r5,#0
65
        beq done
66
 
67
# Output a character (in arm mode).
68
 
69
        mov r0,#3
70
        mov r1,r4
71
        swi #0x123456
72
 
73
# Load next character, see if done.
74
 
75
        add r4,r4,#1
76
        sub r3,r3,r3
77
        ldrb r5,[r4,r3]
78
        teq r5,#0
79
        bne output_next
80
 
81
done:
82
        mov r0,#0x18
83
        ldr r1,exit_code
84
        swi #0x123456
85
 
86
# If that fails, try to die with an invalid insn.
87
 
88
        invalid
89
 
90
exit_code:
91
        .word 0x20026

powered by: WebSVN 2.1.0

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