Line 1... |
Line 1... |
;
|
;
|
; hello.s -- Hello, world!
|
; hello.s -- Hello, world!
|
;
|
;
|
|
|
.set tba,0xF0300000 ; terminal base address
|
.set tba,0xF0300000 ; terminal base address
|
.set tos,0xC0010000 ; top of stack
|
.set tos,0xC0020000 ; top of stack
|
|
|
; get some addresses listed in the load map
|
; get some addresses listed in the load map
|
.export reset
|
|
.export start
|
.export start
|
|
.export main
|
.export out
|
.export out
|
.export hello
|
.export hello
|
|
|
; minimal execution environment
|
; minimal execution environment
|
reset:
|
start:
|
add $29,$0,tos ; setup stack
|
add $29,$0,tos ; setup stack
|
jal start ; do useful work
|
jal main ; do useful work
|
reset1:
|
start1:
|
j reset1 ; halt by looping
|
j start1 ; halt by looping
|
|
|
; main program
|
; main program
|
start:
|
main:
|
sub $29,$29,8 ; create stack frame
|
sub $29,$29,8 ; create stack frame
|
stw $31,$29,0 ; save return register
|
stw $31,$29,0 ; save return register
|
stw $16,$29,4 ; save register variable
|
stw $16,$29,4 ; save register variable
|
add $16,$0,hello ; pointer to string
|
add $16,$0,hello ; pointer to string
|
loop:
|
loop:
|