User Tools

Site Tools


en-us_products:mpino_studio2:box_functions:bit_operations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en-us_products:mpino_studio2:box_functions:bit_operations [2026/09/09 17:54] – 만듦 - 바깥 편집 127.0.0.1en-us_products:mpino_studio2:box_functions:bit_operations [2026/09/10 01:05] (current) – 바깥 편집 127.0.0.1
Line 5: Line 5:
 {{ :en-us_products:mpino_studio2:bit-operation-map.svg?1000 |These commands apply logic, shift, or rotate operations to the bits in a WORD. }} {{ :en-us_products:mpino_studio2:bit-operation-map.svg?1000 |These commands apply logic, shift, or rotate operations to the bits in a WORD. }}
  
-This ladder screen compares the input forms of WAND, SHL, and ROL. +===== Common Rules =====
- +
-{{ :en-us_products:mpino_studio2:ladder-wand-shl-rol-2x.png?1000 |This ladder screen compares the input forms of WAND, SHL, and ROL. }} +
- +
-===== 1. Common Rules =====+
  
 Bit-operation commands process all 16 bits in a WORD. A shift discards bits that leave the word and fills with zero; a rotate brings those bits back at the opposite end. Bit-operation commands process all 16 bits in a WORD. A shift discards bits that leave the word and fills with zero; a rotate brings those bits back at the opposite end.
  
-===== 2. WAND, WOR, and WXOR ===== +===== Box Function List =====
- +
-==== WAND ==== +
- +
-**Word AND** +
- +
-Applies bitwise AND to two WORD values and stores the result. +
- +
-**Syntax:** ''WAND D0 D1 D2'' +
- +
-^ Run condition ^ Before ^ Command entered ^ Expected result ^ +
-| Left condition ON | D0=0x00CC, D1=0x00AA | ''WAND D0 D1 D2'' | D2=0x0088 | +
- +
-==== WOR ==== +
- +
-**Word OR** +
- +
-Applies bitwise OR to two WORD values and stores the result. +
- +
-**Syntax:** ''WOR D0 D1 D2'' +
- +
-^ Run condition ^ Before ^ Command entered ^ Expected result ^ +
-| Left condition ON | D0=0x00CC, D1=0x00AA | ''WOR D0 D1 D2'' | D2=0x00EE | +
- +
-==== WXOR ==== +
- +
-**Word XOR** +
- +
-Applies bitwise XOR to two WORD values and stores the result. +
- +
-**Syntax:** ''WXOR D0 D1 D2'' +
- +
-^ Run condition ^ Before ^ Command entered ^ Expected result ^ +
-| Left condition ON | D0=0x00CC, D1=0x00AA | ''WXOR D0 D1 D2'' | D2=0x0066 | +
- +
-===== 3. WNOT ===== +
- +
-**Word NOT** +
- +
-Inverts every bit in the source WORD and stores the result. +
- +
-**Syntax:** ''WNOT D0 D1'' +
- +
-**Arguments** +
- +
-  * 1st = S: source address or constant to invert +
-  * 2nd = D: result destination address +
- +
-^ Run condition ^ Before ^ Command entered ^ Expected result ^ +
-| Left condition ON | D0=0x00CC | ''WNOT D0 D1'' | D1=0xFF33 | +
- +
-===== 4. SHL and SHR ===== +
- +
-==== SHL ==== +
- +
-**Shift Left** +
- +
-Shifts a WORD left and stores the result. Bits leaving the left are discarded and zeros fill from the right. Use a shift count from 0 to 15. +
- +
-**Syntax:** ''SHL D0 2 D1'' +
- +
-**Arguments** +
- +
-  * 1st = source: integer WORD address +
-  * 2nd = shift count: 0 to 15 +
-  * 3rd = destination: result address +
- +
-^ Run condition ^ Before ^ Command entered ^ Expected result ^ +
-| Left condition ON | D0=0x0003 | ''SHL D0 2 D1'' | D1=0x000C | +
- +
-==== SHR ==== +
- +
-**Shift Right** +
- +
-Logically shifts a D WORD right and stores the result. Bits leaving the right are discarded and zeros fill from the left. +
- +
-**Syntax:** ''SHR D0 1 D1'' +
- +
-**Arguments** +
- +
-  * 1st = source: D WORD address +
-  * 2nd = shift count: 0 to 15 +
-  * 3rd = destination: result address +
- +
-^ Run condition ^ Before ^ Command entered ^ Expected result ^ +
-| Left condition ON | D0=0x000C | ''SHR D0 1 D1'' | D1=0x0006 | +
- +
-===== 5. ROL and ROR ===== +
- +
-==== ROL ==== +
- +
-**Rotate Left** +
- +
-Rotates a D, C, or T WORD left. Bits leaving the left return at the right end. +
- +
-**Syntax:** ''ROL D0 2 D1'' +
- +
-**Arguments** +
- +
-  * 1st = source: D, C, or T WORD address +
-  * 2nd = rotate count +
-  * 3rd = destination: D, C, or T WORD address +
- +
-^ Run condition ^ Before ^ Command entered ^ Expected result ^ +
-| Left condition ON | D0=0x8001 | ''ROL D0 2 D1'' | D1=0x0006 | +
- +
-==== ROR ==== +
- +
-**Rotate Right** +
- +
-Rotates a D, C, or T WORD right. Bits leaving the right return at the left end. +
- +
-**Syntax:** ''ROR D0 1 D1'' +
- +
-**Arguments** +
- +
-  * 1st = source: D, C, or T WORD address +
-  * 2nd = rotate count +
-  * 3rd = destination: D, C, or T WORD address +
- +
-^ Run condition ^ Before ^ Command entered ^ Expected result ^ +
-| Left condition ON | D0=0x0003 | ''ROR D0 1 D1'' | D1=0x8001 | +
- +
-===== 6. Troubleshooting =====+
  
-Symptom What to check +Command Meaning 
-A sign bit does not fill the left side during a right shift. | SHR is logical shift that fills the upper empty bits with zero. | +[[en-us_products:mpino_studio2:box_functions:bit_operations:wand|WAND]] | Applies bitwise AND to two WORD values and stores the result. | 
-Bits disappear after shift. | Use ROL or ROR instead of SHL or SHR when the shifted-out bits must be preserved. |+| [[en-us_products:mpino_studio2:box_functions:bit_operations:wor|WOR]] | Applies bitwise OR to two WORD values and stores the result. | 
 +| [[en-us_products:mpino_studio2:box_functions:bit_operations:wxor|WXOR]] | Applies bitwise XOR to two WORD values and stores the result. | 
 +| [[en-us_products:mpino_studio2:box_functions:bit_operations:wnot|WNOT]] | Inverts every bit in the source WORD and stores the result. | 
 +| [[en-us_products:mpino_studio2:box_functions:bit_operations:shl|SHL]] | Shifts WORD left and stores the result. | 
 +[[en-us_products:mpino_studio2:box_functions:bit_operations:shr|SHR]] | Logically shifts D WORD right and stores the result. | 
 +| [[en-us_products:mpino_studio2:box_functions:bit_operations:rol|ROL]] | Rotates a D, C, or T WORD left. | 
 +| [[en-us_products:mpino_studio2:box_functions:bit_operations:ror|ROR]] | Rotates a D, C, or T WORD right. |
  
 ===== Related Documentation ===== ===== Related Documentation =====
  
   * [[en-us_products:mpino_studio2:box_functions|Phase 4 · Box Functions]]   * [[en-us_products:mpino_studio2:box_functions|Phase 4 · Box Functions]]
-  * [[en-us_products:mpino_studio2:box_functions:transfer|Transfer Box Functions]] 
-  * [[en-us_products:mpino_studio2:box_functions:conversion|Conversion Box Functions]] 
   * [[en-us_products:mpino_studio2|MPINO STUDIO 2 User Manual]]   * [[en-us_products:mpino_studio2|MPINO STUDIO 2 User Manual]]
  
en-us_products/mpino_studio2/box_functions/bit_operations.1788944071.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki