Absolute/fi: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | - | ||
| 2 | - | ||
| 1 | + | `Absolute` [[modifier/fi|modifoija]] aiheuttaa [[Variable/fi|muuttujan]] tallentamisen samaan muistialueeseen kuin toinen muuttuja. | |
| 2 | + | ||
| 3 | + | ``` pascal | |
| 3 | 4 | // Esimerkki little endian x64 prosessori | |
| 4 | - | ||
| 5 | - | ||
| 6 | - | ||
| 7 | - | ||
| 8 | - | ||
| 9 | - | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - | ||
| 5 | + | Uses SysUtils; | |
| 6 | + | ||
| 7 | + | Var | |
| 8 | + | anInt : Integer; | |
| 9 | + | anotherInt : Integer absolute anInt; | |
| 10 | + | firstByte : Byte absolute anInt; | |
| 11 | + | ||
| 12 | + | begin | |
| 13 | + | // Kun molemmat integer-muuttujat ovat samassa muistipaikassa niin muutos heijastuu | |
| 14 | + | // myös toisessakin | |
| 15 | + | anInt := 20; | |
| 16 | + | ||
| 17 | + | WriteLn(IntToStr(anInt) + ' ' + IntToStr(anotherInt)); // Tulostuu: 20 20 | |
| 18 | + | ||
| 19 | + | // Lukuarvo 20 sopii tavun kokoiseen muistipaikkaan | |
| 20 | + | ||
| 21 | + | WriteLn('firstByte: ' + IntToStr(firstByte)); // Tulostuu: firstByte: 20 | |
| 22 | + | ||
| 23 | + | anotherInt := 333; | |
| 24 | + | ||
| 25 | + | WriteLn(IntToStr(anInt) + ' ' + IntToStr(anotherInt)); // Tulostuu: 333 333 | |
| 26 | + | ||
| 27 | + | // Luku 333 on liian iso sopiakseen tavun kokoiseen muistipaikkaan | |
| 28 | + | // little-endian x64 - vähiten merkitsevä tavu on ensimmäisenä muistissa: | |
| 29 | + | // 333 = 101001101 = 01001101 00000001 muistissa = $4D $01 = desimaalisena: 77 1 | |
| 30 | + | ||
| 31 | + | WriteLn('firstByte: ' + IntToStr(firstByte)); // Tulostuu: firstByte: 77 | |
| 32 | + | end. | |
| 32 | 33 | ``` | |
| 33 | 34 | ||
| 34 | 35 | --- | |
| 35 | - | ||
| 36 | + | *From the Free Pascal wiki, page "Absolute/fi", as it stood on 2022-08-06 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
