-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for PutVarChr statements
- Loading branch information
1 parent
01ae6ea
commit 7e1f6f9
Showing
5 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
PutVarChr VAR OFFSET VAR [TYPE] | ||
|
||
The "write-mode" alternative of the previous command which | ||
allows to perform various complex operations with custom | ||
algorithms (like in my Deer Hunter 2004/2005 scripts). | ||
It can be compared to C as: var1[offset] = var2; | ||
Note that PutVarChr can be also used as an allocator of memory | ||
that is often useful in the implementation of custom | ||
decompression algorithms or, moreover, for pre-allocating a | ||
MEMORY_FILE for storing chunks. This is useful to avoid wasting | ||
time and memory with the incremental allocation, remember only | ||
to use the command "Log MEMORY_FILE 0 0" after it for resetting | ||
the position of the MEMORY_FILE. | ||
|
||
arguments | ||
VAR Variable or memory file in which you want to put | ||
the element | ||
OFFSET Position of the output where placing the element, | ||
it can also be negative in which case it will work | ||
from the end of the variable (may not work in some | ||
conditions) | ||
VAR Source variable which will contain the element to | ||
write, it's also possible to store the address of | ||
the variable which may be useful with external DLLs | ||
TYPE Type of the element to read and assign to the first | ||
variable, if not specified it's a BYTE (8bit). | ||
You can specify most of the available datatypes | ||
like short, long, longlong and so on. | ||
|
||
Examples: | ||
For i = 0 < SIZE | ||
GetVarChr TMP MEMORY_FILE i | ||
Math TMP ^= 0xff | ||
PutVarChr MEMORY_FILE i TMP | ||
Next i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
================================================================================ | ||
PutVarChr statements | ||
================================================================================ | ||
|
||
For i = 0 < SIZE | ||
GetVarChr TMP MEMORY_FILE i | ||
Math TMP ^= 0xff | ||
PutVarChr MEMORY_FILE i TMP | ||
Next i | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
(source_file | ||
(for_statement | ||
(for) | ||
(identifier) | ||
(operation) | ||
(integer_literal) | ||
(comparison) | ||
(identifier) | ||
(getvarchr_statement | ||
(getvarchr) | ||
(identifier) | ||
(identifier) | ||
(identifier)) | ||
(math_statement | ||
(math) | ||
(identifier) | ||
(operation) | ||
(integer_literal)) | ||
(putvarchr_statement | ||
(putvarchr) | ||
(identifier) | ||
(identifier) | ||
(identifier)) | ||
(next_statement | ||
(next) | ||
(identifier)))) |