; File name: sattest.asm ; ; C5402 demonstration test code ; ; 31Jan02 .. initial version .. KM .mmregs .data .bss onefourth,1 .text .global _c_int00 _c_int00: ; test the effects of the sign extension bit ssbx sxm ; turn sign extension on ld #0,a ; zero the a accumulator ld #0,b ; zero the b accumulator ld #0FFFFh,b nop nop rsbx sxm ; turn sign extension off nop ld #0FFFFh,a ld #0,b nop nop ; investigate sst bit effect + overflow ssbx sxm ; turn sign extension on ld #0,a ; zero the a accumulator ld #0,b ; zero the b accumulator add #07000h,16,a ; add 7/8 in fractional format add #07000h,16,a ; sum is 1 5/8 andm #0FFFEh,pmst ; set SST to no saturation nop ; had pipeline warning nop ; had pipeline warning nop ; had pipeline warning sth a,*(bh) nop nop nop orm #00001h, pmst ; set sst to saturate ld #0,b ; zero the b accumulator nop ; had pipeline warning nop ; had pipeline warning sth a,*(bh) nop nop nop ; investigate sst bit effect - overflow ssbx sxm ; turn sign extension on ld #0,a ; zero the a accumulator ld #0,b ; zero the b accumulator add #09000h,16,a ; add -7/8 in fractional format add #09000h,16,a ; sum is -1 5/8 andm #0FFFEh,pmst ; set SST to no saturation nop ; had pipeline warning nop ; had pipeline warning nop ; had pipeline warning sth a,*(bh) ; stores positive value not negative nop nop nop orm #00001h, pmst ; set sst to saturate ld #0,b ; zero the b accumulator nop ; had pipeline warning nop ; had pipeline warning sth a,*(bh) ; interesting..did not sign extend nop ; would have been ok if there were nop ; not an accumulator...look out! nop here: b here