Wednesday 12 December 2007

Detecting the mode of the ARM processor from Forth


Detecting the ARM processor mode from Forth.
Modern ARM processors have no 26Bit mode, they do support an emulator

To detect the mode you are running in.

code 32bit?
stmfd sp !, { tos }
teq r0, r0
teq pc, pc
mvn eq tos, # 0
mov ne tos, # 0
next c;

Returns true if 32bit or false otherwise.

This example is from WimpForth for RISCOS (a version that runs on StrongARM) can be found at http://www.leginda.com