Drkcore

21 10 2009 SPIM Tweet

spim

グローバル変数の代入

    .data

    .globl src
src: .word 2001

    .globl dst
dst: .word 0

    .text
    .globl main
main:
    la $t0, src
    lw $s0, 0($t0)
    la $t1, dst
    sw $s0, 0($t1)
    li $v0, 0
    jr $ra

実行。printでメモリアドレスとか内容が表示されるので、runの前後で比較する。

$ spim
SPIM Version 7.4 of January 1, 2009
Copyright 1990-2004 by James R. Larus (larus@cs.wisc.edu).
All Rights Reserved.
See the file README for a full copyright notice.
Loaded: /opt/local/share/spim/exceptions.s
(spim) load "ls.as"
(spim) print dst
Data seg @ 0x10010004 (268500996) = 0x00000000 (0)
(spim) print src
Data seg @ 0x10010000 (268500992) = 0x000007d1 (2001)
(spim) run
(spim) print dst
Data seg @ 0x10010004 (268500996) = 0x000007d1 (2001)
(spim) print src
Data seg @ 0x10010000 (268500992) = 0x000007d1 (2001)

ProductName Cとアセンブリ言語で学ぶ計算機プログラミングの基礎概念 - プログラムはプロセッサ上でどのように実行されるのか
角川 裕次
森北出版 / ¥ 5,040 ()
在庫あり。

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021