ack/mach/m68020/libem/sar.s

57 lines
1 KiB
ArmAsm
Raw Normal View History

1987-01-29 22:10:18 +00:00
.define .sar
.sect .text
.sect .rom
.sect .data
.sect .bss
1988-10-03 10:53:47 +00:00
EILLINS=18
1987-01-29 22:10:18 +00:00
.sect .text
! (on entry d0 contains the integer size in the descriptor)
.sar:
cmp.l #4, d0
beq 9f
move.l #EILLINS, -(sp)
jmp (.fatal)
9:
! register usage:
! a0: descriptor address
! a1: base address
! d0: index
! d1: # bytes / element
! For address calculation; see comment in 'aar.s'.
! If the element size is a fraction of EM_WSIZE (4)
! the calculation is done by adding.
1988-10-03 10:53:47 +00:00
move.l (sp)+, d1 ! return address
1987-01-29 22:10:18 +00:00
move.l (sp)+, a0
move.l (sp)+, d0
move.l (sp)+, a1
1988-10-03 10:53:47 +00:00
move.l d1,-(sp) ! return address
1987-01-29 22:10:18 +00:00
sub.l (a0), d0
move.l (8,a0), d1 ! # bytes / element
cmp.l #1, d1
bne 2f
1988-10-03 10:53:47 +00:00
move.l (sp)+,a0
1987-01-29 22:10:18 +00:00
move.l (sp)+, d1
move.b d1, (a1,d0.l) ! store one byte element
1988-10-03 10:53:47 +00:00
jmp (a0)
1987-01-29 22:10:18 +00:00
2:
cmp.l #2, d1
bne 4f
1988-10-03 10:53:47 +00:00
move.l (sp)+,a0
1987-01-29 22:10:18 +00:00
move.l (sp)+, d1
move.w d1, (a1,d0.l*2) ! store two byte element
1988-10-03 10:53:47 +00:00
jmp (a0)
1987-01-29 22:10:18 +00:00
4: ! here: 4n byte element
muls.l d1, d0
add.l d0, a1 ! address of 4n byte element
asr.l #2, d1
1988-10-03 10:53:47 +00:00
move.l (sp)+,a0
1987-01-29 22:10:18 +00:00
1:
move.l (sp)+, (a1)+
sub.l #1, d1
bne 1b
1987-01-29 22:10:18 +00:00
jmp (a0)
.align 2