///////////////////////////////////////////////////////////////////////////////
//                            Lisaac OS Library                              //
//                                                                           //
//                   LSIIT - ULP - CNRS - INRIA - FRANCE                     //
//                                                                           //
//   This program is free software: you can redistribute it and/or modify    //
//   it under the terms of the GNU General Public License as published by    //
//   the Free Software Foundation, either version 3 of the License, or       //
//   (at your option) any later version.                                     //
//                                                                           //
//   This program is distributed in the hope that it will be useful,         //
//   but WITHOUT ANY WARRANTY; without even the implied warranty of          //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           //
//   GNU General Public License for more details.                            //
//                                                                           //
//   You should have received a copy of the GNU General Public License       //
//   along with this program.  If not, see <http://www.gnu.org/licenses/>.   //
//                                                                           //
//                     http://isaacproject.u-strasbg.fr/                     //
///////////////////////////////////////////////////////////////////////////////
Section Header
  
  - name        := PROCESSOR;

  - copyright   := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
  
  - category    := MICRO;
  
  - bibliography:= "http://IsaacOS.com";
  - author      := "Sonntag Benoit (bsonntag@loria.fr)";
  - comment     := "Processor object.";

Section Public
  
  - to_intel_ulong v:UINTEGER_64 :UINTEGER_64 <- deferred;
  
  - to_intel_uint v:UINTEGER_32 :UINTEGER_32 <- deferred;
  
  - to_intel_ushort v:UINTEGER_16 :UINTEGER_16 <- deferred;
  
  - to_motorola_ulong v:UINTEGER_64 :UINTEGER_64 <-
  (    
    (v << 56) | ((v & 0FF00h) << 40) | ((v & 0FF0000h) << 24) | ((v & 0FF000000h) << 8) |
           (v >> 56)   | ((v >> 40) & 0FF00h) | ((v >> 24) & 0FF0000h) | ((v >> 8) & 0FF000000h)
  );
  
  - to_motorola_uint v:UINTEGER_32 :UINTEGER_32 <-
  (
    (v << 24) | ((v & 0FF00h) << 8) | ((v >> 8) & 0FF00h) | (v >> 24)     
  );
  
  - to_motorola_int v:INTEGER :INTEGER <-
  (
    // Conversion in uxxx to cut the sign
    (v  << 24) | (((v & 0FF00h) << 8).to_uinteger_16) | (((v >> 8) & 0FF00h).to_uinteger_16) | ((v >> 24).to_uinteger_8)     
  );
  
  - to_motorola_ushort v:UINTEGER_16 :UINTEGER_16 <-
  (
    (v  << 8) | (v >> 8)
  );

  - to_motorola_short v:INTEGER_16 :INTEGER_16 <-
  (
    // Conversion in usmall to cut the sign
    ((v << 8) | ((v >> 8) & 0FFh))
  );

