| 1 |
(* BitBlockOps.def provides a Logitech compatible module. |
| 2 |
|
| 3 |
Copyright (C) 2007-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by Gaius Mulley <[email protected]>. |
| 5 |
|
| 6 |
This file is part of GNU Modula-2. |
| 7 |
|
| 8 |
GNU Modula-2 is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; either version 3, or (at your option) |
| 11 |
any later version. |
| 12 |
|
| 13 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 14 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
General Public License for more details. |
| 17 |
|
| 18 |
Under Section 7 of GPL version 3, you are granted additional |
| 19 |
permissions described in the GCC Runtime Library Exception, version |
| 20 |
3.1, as published by the Free Software Foundation. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License and |
| 23 |
a copy of the GCC Runtime Library Exception along with this program; |
| 24 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 25 |
<http://www.gnu.org/licenses/>. *) |
| 26 |
|
| 27 |
DEFINITION MODULE BitBlockOps ; |
| 28 |
|
| 29 |
|
| 30 |
FROM SYSTEM IMPORT ADDRESS ; |
| 31 |
|
| 32 |
|
| 33 |
(* |
| 34 |
BlockAnd - performs a bitwise AND on blocks |
| 35 |
[dest..dest+size-1] := [dest..dest+size-1] AND |
| 36 |
[src..src+size-1] |
| 37 |
*) |
| 38 |
|
| 39 |
PROCEDURE BlockAnd (dest, src: ADDRESS; size: CARDINAL) ; |
| 40 |
|
| 41 |
|
| 42 |
(* |
| 43 |
BlockOr - performs a bitwise OR on blocks |
| 44 |
[dest..dest+size-1] := [dest..dest+size-1] OR |
| 45 |
[src..src+size-1] |
| 46 |
*) |
| 47 |
|
| 48 |
PROCEDURE BlockOr (dest, src: ADDRESS; size: CARDINAL) ; |
| 49 |
|
| 50 |
|
| 51 |
(* |
| 52 |
BlockXor - performs a bitwise XOR on blocks |
| 53 |
[dest..dest+size-1] := [dest..dest+size-1] XOR |
| 54 |
[src..src+size-1] |
| 55 |
*) |
| 56 |
|
| 57 |
PROCEDURE BlockXor (dest, src: ADDRESS; size: CARDINAL) ; |
| 58 |
|
| 59 |
|
| 60 |
(* |
| 61 |
BlockNot - performs a bitsize NOT on the block as defined |
| 62 |
by: [dest..dest+size-1] |
| 63 |
*) |
| 64 |
|
| 65 |
PROCEDURE BlockNot (dest: ADDRESS; size: CARDINAL) ; |
| 66 |
|
| 67 |
|
| 68 |
(* |
| 69 |
BlockShr - performs a block shift right of, count, bits. |
| 70 |
Where the block is defined as: |
| 71 |
[dest..dest+size-1]. |
| 72 |
The block is considered to be an ARRAY OF BYTEs |
| 73 |
which is shifted, bit at a time over each byte in |
| 74 |
turn. The left most byte is considered the byte |
| 75 |
located at the lowest address. |
| 76 |
If you require an endianness SHIFT use |
| 77 |
the SYSTEM.SHIFT procedure and declare the |
| 78 |
block as a POINTER TO set type. |
| 79 |
*) |
| 80 |
|
| 81 |
PROCEDURE BlockShr (dest: ADDRESS; size, count: CARDINAL) ; |
| 82 |
|
| 83 |
|
| 84 |
(* |
| 85 |
BlockShl - performs a block shift left of, count, bits. |
| 86 |
Where the block is defined as: |
| 87 |
[dest..dest+size-1]. |
| 88 |
The block is considered to be an ARRAY OF BYTEs |
| 89 |
which is shifted, bit at a time over each byte in |
| 90 |
turn. The left most byte is considered the byte |
| 91 |
located at the lowest address. |
| 92 |
If you require an endianness SHIFT use |
| 93 |
the SYSTEM.SHIFT procedure and declare the |
| 94 |
block as a POINTER TO set type. |
| 95 |
*) |
| 96 |
|
| 97 |
PROCEDURE BlockShl (dest: ADDRESS; size, count: CARDINAL) ; |
| 98 |
|
| 99 |
|
| 100 |
(* |
| 101 |
BlockRor - performs a block rotate right of, count, bits. |
| 102 |
Where the block is defined as: |
| 103 |
[dest..dest+size-1]. |
| 104 |
The block is considered to be an ARRAY OF BYTEs |
| 105 |
which is rotated, bit at a time over each byte in |
| 106 |
turn. The left most byte is considered the byte |
| 107 |
located at the lowest address. |
| 108 |
If you require an endianness ROTATE use |
| 109 |
the SYSTEM.ROTATE procedure and declare the |
| 110 |
block as a POINTER TO set type. |
| 111 |
*) |
| 112 |
|
| 113 |
PROCEDURE BlockRor (dest: ADDRESS; size, count: CARDINAL) ; |
| 114 |
|
| 115 |
|
| 116 |
(* |
| 117 |
BlockRol - performs a block rotate left of, count, bits. |
| 118 |
Where the block is defined as: |
| 119 |
[dest..dest+size-1]. |
| 120 |
The block is considered to be an ARRAY OF BYTEs |
| 121 |
which is rotated, bit at a time over each byte in |
| 122 |
turn. The left most byte is considered the byte |
| 123 |
located at the lowest address. |
| 124 |
If you require an endianness ROTATE use |
| 125 |
the SYSTEM.ROTATE procedure and declare the |
| 126 |
block as a POINTER TO set type. |
| 127 |
*) |
| 128 |
|
| 129 |
PROCEDURE BlockRol (dest: ADDRESS; size, count: CARDINAL) ; |
| 130 |
|
| 131 |
|
| 132 |
END BitBlockOps. |