home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
progasm
/
sprcbnch.arj
/
ACK.S
next >
Wrap
Text File
|
1991-11-05
|
795b
|
62 lines
!
! exercise function call/return mechanism
! by computing Ackermann's function
!
mov 3,%o0
call _ack
mov 3,%o1
exit:
mov 1,%g1
ta 0
_ack:
!#PROLOGUE# 0
! sethi %hi(LF12),%g1
! add %g1,%lo(LF12),%g1
save %sp,-96,%sp
!#PROLOGUE# 1
st %i0,[%fp+0x44]
st %i1,[%fp+0x48]
ld [%fp+0x44],%o0
tst %o0
bne L14
nop
ld [%fp+0x48],%o0
add %o0,0x1,%o0
b LE12
nop
L14:
ld [%fp+0x48],%o1
tst %o1
bne L15
nop
ld [%fp+0x44],%o0
sub %o0,0x1,%o0
mov 0x1,%o1
call _ack
nop
mov %o0,%i0
jmpl %i7+8,%g0
restore %g0,%g0,%g0
L15:
ld [%fp+0x48],%o1
sub %o1,0x1,%o1
ld [%fp+0x44],%o0
call _ack
nop
mov %o0,%o1
ld [%fp+0x44],%o0
sub %o0,0x1,%o0
call _ack
nop
b LE12
nop
LE12:
mov %o0,%i0
ret
restore %g0,%g0,%g0