File: test-rfrs.apoo

package info (click to toggle)
apoo 2.2-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 560 kB
  • ctags: 425
  • sloc: python: 3,092; perl: 100; makefile: 56; sh: 4
file content (31 lines) | stat: -rw-r--r-- 525 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
n:	const 5
	loadn 4 r1
      # argument
	push r1
	zero r1
	jsr test
	pop r1
	halt
test:	push rf 
	#saves the current frame pointer
	#current frame pointer
	storer rs rf 
	loadn  6 r2
	# reserves some local space
	add    r2 rs 
	 # gets the argument  
        loado -2 r1 
       # only testing the rs
	push r1    
	pop r1
	#stores contents of r1 at rf+1
	storeo r1 1
	#loads the same value into r3
	loado 1 r3  
	# restores stack before return 
	sub rs r2   
	storer r2 rs
	# restores frame before return
	pop rf      
	rtn