2018-09-05 21:53:38 +00:00
|
|
|
#
|
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
|
|
|
|
2018-09-08 20:42:06 +00:00
|
|
|
.sect .text
|
2018-09-08 20:06:38 +00:00
|
|
|
.define .c_uf_i
|
|
|
|
.c_uf_i:
|
2018-09-05 21:53:38 +00:00
|
|
|
/* Input: f0
|
|
|
|
* Output: r2
|
2018-09-09 16:25:00 +00:00
|
|
|
* Only at and f30/f31 may be used.
|
2018-09-05 21:53:38 +00:00
|
|
|
*/
|
2018-09-08 20:42:06 +00:00
|
|
|
|
2018-09-12 20:28:40 +00:00
|
|
|
lui at, ha16[.ff_80000000]
|
2018-09-09 16:25:00 +00:00
|
|
|
lwc1 f30, lo16[.ff_80000000] (at)
|
|
|
|
c.le.s 0, f30, f0
|
2018-09-05 21:53:38 +00:00
|
|
|
bc1t toobig
|
|
|
|
nop
|
|
|
|
|
2018-09-08 20:42:06 +00:00
|
|
|
trunc.w.s f0, f0
|
2018-09-05 21:53:38 +00:00
|
|
|
mfc1 r2, f0
|
|
|
|
jr ra
|
|
|
|
nop
|
|
|
|
|
|
|
|
toobig:
|
2018-09-09 16:25:00 +00:00
|
|
|
sub.s f0, f0, f30
|
2018-09-08 20:42:06 +00:00
|
|
|
trunc.w.s f0, f0
|
2018-09-05 21:53:38 +00:00
|
|
|
mfc1 r2, f0
|
2018-09-12 21:58:48 +00:00
|
|
|
lui at, 0x8000 ! load 0x80000000
|
|
|
|
addu r2, r2, at
|
2018-09-05 21:53:38 +00:00
|
|
|
jr ra
|
|
|
|
nop
|
|
|
|
|
2018-09-09 22:21:16 +00:00
|
|
|
.sect .rom
|
|
|
|
.ff_80000000:
|
2018-09-10 20:56:18 +00:00
|
|
|
.dataf4 2147483648.0
|
2018-09-09 22:21:16 +00:00
|
|
|
|