2013-05-25 12:31:27 +00:00
|
|
|
#
|
|
|
|
/*
|
|
|
|
* VideoCore IV support library for the ACK
|
|
|
|
* © 2013 David Given
|
|
|
|
* This file is redistributable under the terms of the 3-clause BSD license.
|
|
|
|
* See the file 'Copying' in the root of the distribution for the full text.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "videocore.h"
|
|
|
|
|
|
|
|
.define .csa
|
|
|
|
.sect .data
|
|
|
|
.csa:
|
|
|
|
! on entry:
|
|
|
|
! r0 = un-fixed-up descriptor
|
|
|
|
! r1 = value
|
|
|
|
add r0, gp
|
|
|
|
|
|
|
|
ld r2, 4 (r0) ! check lower bound
|
2013-06-05 22:57:23 +00:00
|
|
|
|
|
|
|
b.lo r1, r2, default ! jump to default if r1 < r2
|
2013-05-25 12:31:27 +00:00
|
|
|
|
|
|
|
sub r1, r2 ! adjust value to be 0-based
|
|
|
|
|
|
|
|
ld r2, 8 (r0) ! check upper bound
|
2013-06-05 22:57:23 +00:00
|
|
|
b.hi r1, r2, default ! jump to default if r1 > r2
|
2013-05-25 12:31:27 +00:00
|
|
|
|
|
|
|
add r1, #3
|
2013-06-05 22:57:23 +00:00
|
|
|
go:
|
2013-05-25 12:31:27 +00:00
|
|
|
ld r1, (r0, r1) ! load destination address
|
|
|
|
add r1, gp
|
|
|
|
b r1 ! ...and go
|
|
|
|
|
2013-06-05 22:57:23 +00:00
|
|
|
default:
|
|
|
|
mov r1, #0 ! index of default value
|
|
|
|
b go
|