Attachment 'macros.inc'

Download

   1 .text
   2 .macro	push	%reg
   3 	addiu	$sp $sp -4
   4 	sw	%reg ($sp)
   5 .end_macro
   6 
   7 .macro	pop	%reg
   8 	lw	%reg ($sp)
   9 	addiu	$sp $sp 4
  10 .end_macro 
  11 
  12 .macro	prologue
  13 	push	$fp
  14 	move	$fp $sp
  15 	sw	$ra -4($sp)
  16 	sw	$s0 -8($sp)
  17 	sw	$s1 -12($sp)
  18 	sw	$s2 -16($sp)
  19 	sw	$s3 -20($sp)
  20 	sw	$s4 -24($sp)
  21 	sw	$s5 -32($sp)
  22 	sw	$s6 -36($sp)
  23 	sw	$s7 -40($sp)
  24 	addiu	$sp $sp -40
  25 	move	$s0 $a0
  26 	move	$s1 $a1
  27 	move	$s2 $a2
  28 	move	$s3 $a3
  29 .end_macro
  30 
  31 .macro	prologue %num	# количество локальных переменных
  32 	prologue
  33 	li	$at %num
  34 	sll	$at $at 2
  35 	addiu	$sp $sp 4
  36 .end_macro
  37 
  38 .macro	epilogue
  39 	move	$sp $fp
  40 	lw	$ra -4($sp)
  41 	lw	$s0 -8($sp)
  42 	lw	$s1 -12($sp)
  43 	lw	$s2 -16($sp)
  44 	lw	$s3 -20($sp)
  45 	lw	$s4 -24($sp)
  46 	lw	$s5 -32($sp)
  47 	lw	$s6 -36($sp)
  48 	lw	$s7 -40($sp)
  49 	pop	$fp
  50 .end_macro 
  51 
  52 .macro	prints	%str
  53 .data
  54 str:	.ascii	%str
  55 	.asciiz	"\n"
  56 .text
  57 	li	$v0 4
  58 	la	$a0 str
  59 	syscall
  60 .end_macro
  61 
  62 .macro	printw	%reg
  63 	li	$v0 1
  64 	move	$a0 %reg
  65 	syscall
  66 	li	$v0 11
  67 	li	$a0 '\n'
  68 	syscall
  69 .end_macro
  70 
  71 .macro	inputw	%reg
  72 	li	$v0 5
  73 	syscall
  74 	move	%reg $v0
  75 .end_macro

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.