next up previous
Next: About this document Up: SAL & SPIM Previous: SAL I/O

Example: Hello World


dec1 1% cat helloworld.s
#
#       SAL program to illustrate simple I/O.
#
                .data
hello:          .asciiz "hello world\n"
                .text
__start:        puts    hello
                done

dec1 2% spim

SPIM Version 4.4.2, Release:  April 22, 1993
Copyright 1990-92 by James R. Larus (larus@cs.wisc.edu)
Modified to read SAL code by Scott Kempf (scottk@cs.wisc.edu)
See the file COPYING for license information

(spim) load "helloworld.s"
(spim) step 5
[0x00400000]     0x3c041001  lui $4, 4097       # puts  hello
[0x00400004]     0x34020004  ori $2, $0, 4      # puts  hello
[0x00400008]     0x0000000c  syscall    # puts  hello
hello world
[0x0040000c]     0x3402000a  ori $2, $0, 10     # done
[0x00400010]     0x0000000c  syscall    # done
(spim) exit

dec1 3% 




CS 301 Class Account
Wed Sep 20 17:20:34 ADT 2000