1985-02-07 22:06:32 +00:00
|
|
|
.define .sar
|
|
|
|
.define .lar
|
|
|
|
.define .aar
|
1986-07-22 13:37:16 +00:00
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
1985-02-07 22:06:32 +00:00
|
|
|
|
|
|
|
!register usage:
|
|
|
|
! a0 : descriptor address
|
|
|
|
! d0 : index
|
|
|
|
! a1 : base address
|
1986-07-22 13:37:16 +00:00
|
|
|
.sect .text
|
1985-02-07 22:06:32 +00:00
|
|
|
.aar:
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l (sp)+,d2 ! return address
|
1985-02-07 22:06:32 +00:00
|
|
|
move.l (sp)+,a0 ! descriptor address
|
|
|
|
move.l (sp)+,d0 ! index
|
|
|
|
move.l (sp)+,a1 ! base address
|
|
|
|
sub.l (a0),d0 ! index - lower bound : relative index
|
|
|
|
move.l 8(a0),-(sp) ! # bytes / element
|
|
|
|
move.l d0,-(sp)
|
|
|
|
jsr .mlu
|
|
|
|
add.l d1,a1 ! address of element
|
|
|
|
move.l a1,-(sp) ! returned on stack
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l d2,-(sp)
|
1985-02-07 22:06:32 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
.lar:
|
|
|
|
! register usage: like .aar
|
|
|
|
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l (sp)+,d2 ! return address
|
1985-02-07 22:06:32 +00:00
|
|
|
move.l (sp)+,a0
|
|
|
|
move.l (sp)+,d0
|
|
|
|
move.l (sp)+,a1
|
|
|
|
sub.l (a0),d0
|
|
|
|
move.l d0,-(sp)
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l 8(a0),d0
|
|
|
|
move.l d0,-(sp)
|
1985-02-07 22:06:32 +00:00
|
|
|
jsr .mlu
|
|
|
|
add.l d1,a1 ! address of element
|
1986-07-22 13:37:16 +00:00
|
|
|
add.l 8(a0),a1 ! a1++ because of predecrement
|
1985-02-07 22:06:32 +00:00
|
|
|
clr.l d1 !?nodig?
|
1986-07-22 13:37:16 +00:00
|
|
|
asr #1,d0
|
1985-02-07 22:06:32 +00:00
|
|
|
bne 3f
|
|
|
|
move.b -(a1),d1 ! 1 byte element
|
|
|
|
move.l d1,-(sp)
|
|
|
|
bra 5f
|
|
|
|
3:
|
1986-07-22 13:37:16 +00:00
|
|
|
asr #1,d0
|
1985-02-07 22:06:32 +00:00
|
|
|
bne 4f
|
|
|
|
move.w -(a1),d1 ! 2 byte element
|
|
|
|
move.l d1,-(sp)
|
|
|
|
bra 5f
|
|
|
|
4:
|
1986-07-22 13:37:16 +00:00
|
|
|
sub.l #1,d0
|
1985-02-07 22:06:32 +00:00
|
|
|
1:
|
|
|
|
move.l -(a1),-(sp) ! 4n byte element (n = 1,2,...)
|
1986-07-22 13:37:16 +00:00
|
|
|
dbf d0,1b
|
1985-02-07 22:06:32 +00:00
|
|
|
5:
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l d2,-(sp)
|
1985-02-07 22:06:32 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
.sar:
|
|
|
|
!register usage: same as lar
|
|
|
|
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l (sp)+,d2
|
1985-02-07 22:06:32 +00:00
|
|
|
move.l (sp)+,a0
|
|
|
|
move.l (sp)+,d0
|
|
|
|
move.l (sp)+,a1
|
|
|
|
sub.l (a0),d0
|
|
|
|
move.l d0,-(sp)
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l 8(a0),d0 ! # bytes / element
|
|
|
|
move.l d0,-(sp)
|
1985-02-07 22:06:32 +00:00
|
|
|
jsr .mlu
|
|
|
|
add.l d1,a1
|
|
|
|
clr.l d1 !?nodig?
|
1986-07-22 13:37:16 +00:00
|
|
|
asr #1,d0
|
1985-02-07 22:06:32 +00:00
|
|
|
bne 3f
|
|
|
|
move.l (sp)+,d1
|
|
|
|
move.b d1,(a1) ! 1 byte element
|
|
|
|
bra 4f
|
|
|
|
3:
|
1986-07-22 13:37:16 +00:00
|
|
|
asr #1,d0
|
1985-02-07 22:06:32 +00:00
|
|
|
bne 5f
|
|
|
|
move.l (sp)+,d1
|
|
|
|
move.w d1,(a1) ! 2 byte element
|
|
|
|
bra 4f
|
|
|
|
5:
|
1986-07-22 13:37:16 +00:00
|
|
|
sub.l #1,d0
|
1985-02-07 22:06:32 +00:00
|
|
|
1:
|
|
|
|
move.l (sp)+,(a1)+ ! 4n byte element (n = 1,2,...)
|
1986-07-22 13:37:16 +00:00
|
|
|
dbf d0,1b
|
1985-02-07 22:06:32 +00:00
|
|
|
4:
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l d2,-(sp)
|
1985-02-07 22:06:32 +00:00
|
|
|
rts
|
1986-07-22 13:37:16 +00:00
|
|
|
|
1985-02-07 22:06:32 +00:00
|
|
|
.align 2
|