RFC 4042:UTF-9 and UTF-18 Efficient Transformation...
RFC-Ref

T2


Click on the red underlined text to get to the source

... T1/ UCS-4 value, P1/ updated byte pointer ; Clobbers T2 UT92U4: TDZA T1 ...
... U92U41: XOR T1,T2 ; insert octet into UCS-4 value LSH T1 ...
... T1,^D8 ; shift UCS-4 value ILDB T2,P1 ; get next nonet TRZE T2,400 ; extract octet, any continuation? ...
... ILDB T2,P1 ; get next nonet TRZE T2,400 ; extract octet, any continuation? JRST U92U41 ; yes, continue XOR ...
... XOR T1,T2 ; insert final octet POPJ P, ...
... ; Returns +1: Always, P1/ updated byte pointer ; Clobbers T1, T2; (T1, T2) must be an accumulator pair ...
... T1, T2; (T1, T2) must be an accumulator pair U42UT9: SETO T2 ...
... T2) must be an accumulator pair U42UT9: SETO T2, ; we'll need some of these 1-bits later ASHC T1 ...
... T1,U42U9X ; done if no more octets LSHC T1,-^D8 ; shift next octet into T2 ROT T2,-1 ; turn it into nonet with high 1 bit ...
... T1,-^D8 ; shift next octet into T2 ROT T2,-1 ; turn it into nonet with high 1 bit PUSHJ P,U42U91 ; recurse for remainder ...
... PUSHJ P,U42U91 ; recurse for remainder U42U9X: LSHC T1,^D9 ; get next nonet back from T2 IDPB T1,P1 ; write nonet ...



Google
Web
RFC-Ref