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 14:49:46 +00:00
|
|
|
move.l 4(sp),a0 ! descriptor address
|
|
|
|
move.l 8(sp),d0 ! index
|
1985-02-07 22:06:32 +00:00
|
|
|
sub.l (a0),d0 ! index - lower bound : relative index
|
|
|
|
move.l 8(a0),-(sp) ! # bytes / element
|
|
|
|
move.l d0,-(sp)
|
|
|
|
jsr .mlu
|
1986-07-22 15:11:09 +00:00
|
|
|
move.l 12(sp),a1 ! base address
|
1985-02-07 22:06:32 +00:00
|
|
|
add.l d1,a1 ! address of element
|
1986-07-22 14:49:46 +00:00
|
|
|
move.l (sp)+,a0 ! return address
|
1986-07-22 15:11:09 +00:00
|
|
|
add.l #8,sp ! pop arguments
|
|
|
|
move.l a1,(sp) ! returned on stack
|
1986-07-22 14:49:46 +00:00
|
|
|
jmp (a0)
|
1985-02-07 22:06:32 +00:00
|
|
|
|
|
|
|
.lar:
|
|
|
|
! register usage: like .aar
|
|
|
|
|
1986-07-22 14:49:46 +00:00
|
|
|
move.l 4(sp),a0
|
|
|
|
move.l 8(sp),d0
|
|
|
|
move.l 12(sp),a1
|
1985-02-07 22:06:32 +00:00
|
|
|
sub.l (a0),d0
|
|
|
|
move.l d0,-(sp)
|
1986-07-22 15:11:09 +00:00
|
|
|
move.l 8(a0),-(sp)
|
1985-02-07 22:06:32 +00:00
|
|
|
jsr .mlu
|
1986-07-22 15:11:09 +00:00
|
|
|
move.l 12(sp),a1
|
|
|
|
move.l 4(sp),a0
|
1985-02-07 22:06:32 +00:00
|
|
|
add.l d1,a1 ! address of element
|
1986-07-25 13:19:51 +00:00
|
|
|
move.l 8(a0),d0
|
|
|
|
add.l d0,a1 ! a1++ because of predecrement
|
1986-07-22 14:49:46 +00:00
|
|
|
move.l (sp)+,a0 ! return address
|
|
|
|
add.l #12,sp ! pop parameters
|
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 14:49:46 +00:00
|
|
|
jmp (a0)
|
1985-02-07 22:06:32 +00:00
|
|
|
|
|
|
|
.sar:
|
|
|
|
!register usage: same as lar
|
|
|
|
|
1986-07-22 14:49:46 +00:00
|
|
|
move.l 4(sp),a0
|
|
|
|
move.l 8(sp),d0
|
|
|
|
move.l 12(sp),a1
|
1985-02-07 22:06:32 +00:00
|
|
|
sub.l (a0),d0
|
|
|
|
move.l d0,-(sp)
|
1986-07-22 15:11:09 +00:00
|
|
|
move.l 8(a0),-(sp)
|
1985-02-07 22:06:32 +00:00
|
|
|
jsr .mlu
|
1986-07-22 15:11:09 +00:00
|
|
|
move.l 12(sp),a1
|
|
|
|
move.l 4(sp),a0
|
1985-02-07 22:06:32 +00:00
|
|
|
add.l d1,a1
|
1986-07-22 15:11:09 +00:00
|
|
|
move.l 8(a0),d0 ! # bytes / element
|
1986-07-22 14:49:46 +00:00
|
|
|
move.l (sp)+,a0 ! return address
|
|
|
|
add.l #12,sp ! pop parameters
|
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.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 14:49:46 +00:00
|
|
|
jmp (a0)
|
1986-07-22 13:37:16 +00:00
|
|
|
|
1985-02-07 22:06:32 +00:00
|
|
|
.align 2
|