I have tested your code and it works as expected here (on no$gba and ideas emulator) with fpc trunk 2.3. Maybe it is a bug related to 2.1.4... :think: