You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/celticiiifunctions.rst
+199-3Lines changed: 199 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Some (not all) of the functions from Celtic III are included in Celtic CE.
8
8
Documentation
9
9
~~~~~~~~~~~~~
10
10
11
-
.. function:: GetListElem: det(30, list_element), Ans = list name
11
+
.. function:: GetListElem: det(30, list_element); Ans = list name
12
12
13
13
Gets a value at ``list_element`` in the list specified. For example, with ``Ans`` equal to ":sub:`L`\FOO" (Where :sub:`L`\ is the list token found in :menuselection:`List --> OPS`). This is useful if the list being accessed is archived, for example.
14
14
@@ -25,7 +25,7 @@ Documentation
25
25
26
26
------------
27
27
28
-
.. function:: GetArgType: det(31), Ans = argument to check
28
+
.. function:: GetArgType: det(31); Ans = argument to check
29
29
30
30
Outputs a real number depicting the type of argument in ``Ans``.
31
31
@@ -68,7 +68,7 @@ Documentation
68
68
69
69
------------
70
70
71
-
.. function:: FindProg: det(33, type), Ans = search string
71
+
.. function:: FindProg: det(33, type); Ans = search string
72
72
73
73
This does not search for file names, instead it searches for file contents. The search string checks for the beginning contents of a program. Type refers to the type of file to search, with 0 being programs and 1 being appvars. The function will return a string containing the names of the files containing the search phrase, with each name separated by a space.
74
74
For example, to look for all the programs beginning with ":DCS", your code would look something like this::
@@ -85,3 +85,199 @@ Documentation
85
85
86
86
Errors:
87
87
* ``..P:NT:FN`` if no files are found containing the specified search string.
88
+
89
+
------------
90
+
91
+
.. function:: UngroupFile: det(34, overwrite); Str0 = group name
92
+
93
+
This function ungroups the programs and AppVars from a group file specified in ``Str0``. It will only apply to files that are programs and AppVars, not other types like lists. If ``overwrite`` is true (not 0), files which already exist will be overwritten. If it is false (0), files will be preserved.
94
+
The group name (in ``Str0``) must be preceded by the ``*row(`` token, as specified in `General Syntax <gensyntax.html#argument-types>`__.
95
+
96
+
Parameters:
97
+
* ``overwrite``: Whether or not to overwrite files that already exist when extracting.
98
+
* ``Str0``: Contains the name of the specified group. The name must be preceded by the ``*row(`` token.
99
+
100
+
Returns:
101
+
* Ungroups all programs and AppVars from the specified group.
102
+
103
+
Errors:
104
+
* ``..G:NT:FN`` if the group specified does not exist.
105
+
* ``..P:NT:FN`` if no files in the group are able to be ungrouped (no programs or AppVars).
106
+
107
+
------------
108
+
109
+
.. function:: GetGroup: det(35); Str0 = group name
110
+
111
+
Puts the names of all program and AppVar files present in the specified group into ``Str9``, separated by spaces. The names will be in the same order in the string as they are found in the group.
112
+
The group name (in ``Str0``) must be preceded by the ``*row(`` token, as specified in `General Syntax <gensyntax.html#argument-types>`__.
113
+
114
+
Parameters:
115
+
* ``Str0``: Contains the name of the specified group. The name must be preceded by the ``*row(`` token.
116
+
117
+
Returns:
118
+
* ``Str9``: Contains a list of the names of all programs and AppVars in the group, separated by spaces.
119
+
120
+
Errors:
121
+
* ``..G:NT:FN`` if the group specified does not exist.
122
+
* ``..P:NT:FN`` if no files in the group are valid (no programs or AppVars).
123
+
124
+
------------
125
+
126
+
.. function:: ExtGroup: det(36, item); Str0 = group name
127
+
128
+
Extracts the program or AppVar specified by ``item`` from the group specified in ``Str0``. If ``item`` is 1, it extracts the first program or AppVar, 2 extracts the second, and so on. This can be useful paired with ``GetGroup`` to figure out the order of the files in the group. If the file already exists with the same name, it will not be overwritten.
129
+
The group name (in ``Str0``) must be preceded by the ``*row(`` token, as specified in `General Syntax <gensyntax.html#argument-types>`__.
130
+
131
+
.. warning::
132
+
``item`` only counts programs and AppVars, and ignores other types, like lists. If ``item`` is 2, it refers to the second **valid** file, not necessarily the second file including all types.
133
+
134
+
Parameters:
135
+
* ``item``: The item in the group to extract. Only applies to programs and AppVars, and begins at 1.
136
+
137
+
Returns:
138
+
* Extracts the specified program or AppVar from the group.
139
+
140
+
Errors:
141
+
* ``..G:NT:FN`` if the group specified does not exist.
142
+
* ``..E:NT:FN`` if the specified item did not exist.
143
+
* ``..P:IS:FN`` if the program already exists.
144
+
145
+
------------
146
+
147
+
.. function:: GroupMem: det(37, item); Str0 = group name
148
+
149
+
Returns the size of the program or AppVar specfied by ``item`` from the group specified in ``Str0``. ``item`` behaves the same way as in ``ExtGroup``.
150
+
The group name (in ``Str0``) must be preceded by the ``*row(`` token, as specified in `General Syntax <gensyntax.html#argument-types>`__.
151
+
152
+
Parameters:
153
+
* ``item``: The item in the group to extract. Only applies to programs and AppVars, and begins at 1.
154
+
155
+
Returns:
156
+
* ``theta``: The size of the specified program or AppVar from the group.
157
+
158
+
Errors:
159
+
* ``..G:NT:FN`` if the group specified does not exist.
160
+
* ``..E:NT:FN`` if the specified item did not exist.
161
+
162
+
------------
163
+
164
+
.. function:: BinRead: det(38, byte_start, number_of_bytes); Str0 = file name
165
+
166
+
Reads the contents of a file starting at ``byte_start`` for ``number_of_bytes`` bytes. ``byte_start`` is 0-indexed, meaning that the first byte of the program is 0, the second is 1, and so on. The output will be a hex string representing the bytes. For example, if the following bytes were in memory:
167
+
168
+
==== == == == == ==
169
+
Byte 0 1 2 3 4
170
+
Data EF 7B 66 6F 6F
171
+
==== == == == == ==
172
+
173
+
``Str9`` would contain this::
174
+
175
+
EF7B666F6F
176
+
177
+
Parameters:
178
+
* ``byte_start``: The byte of the file to start reading from. It is 0-indexed, so the first byte of the file is 0, the second is 1, and so on.
179
+
* ``number_of_bytes``: The number of bytes to read, starting at ``byte_start``. You can also read past the end of the file.
180
+
* ``Str0``: The name of the file to read from. For AppVars, the name should be preceded by the ``rowSwap(`` token.
181
+
182
+
Returns:
183
+
* ``Str9``: Contains a text string of hex representing the bytes read.
184
+
185
+
------------
186
+
187
+
.. function:: BinWrite: det(39, byte_start); Str9 = hex string to write; Str0 = file name
188
+
189
+
Writes the hex bytes represented in ``Str9`` to the file specified by ``Str0``, starting at ``byte_start``. ``byte_start`` is 0-indexed, meaning that the first byte of the program is 0, the second is 1, and so on.
190
+
191
+
Parameters:
192
+
* ``byte_start``: The byte of the file to start writing to. It is 0-indexed, so the first byte of the file is 0, the second is 1, and so on.
193
+
* ``Str9``: Contains a text string of hex representing the bytes to write.
194
+
* ``Str0``: The name of the file to write to. For AppVars, the name should be preceded by the ``rowSwap(`` token.
195
+
196
+
Returns:
197
+
* Writes the bytes specified in ``Str9`` to the specified file.
198
+
199
+
Errors:
200
+
* ``..E:NT:FN`` if ``byte_start`` is past the end of the file.
201
+
* ``..INVAL:S`` if there is not an even number of characters in the string or an invalid hex character is present.
202
+
* ``..NT:EN:M`` if there is not enough memory to complete the write.
203
+
204
+
------------
205
+
206
+
.. function:: BinDelete: det(40, byte_start, number_of_bytes); Str0 = file name
207
+
208
+
Deletes the ``number_of_bytes`` bytes from the file specified by ``Str0``, starting at ``byte_start``. ``byte_start`` is 0-indexed, meaning that the first byte of the program is 0, the second is 1, and so on.
209
+
210
+
Parameters:
211
+
* ``byte_start``: The byte of the file to start deleting from. It is 0-indexed, so the first byte of the file is 0, the second is 1, and so on.
212
+
* ``number_of_bytes``: The number of bytes to delete.
213
+
* ``Str0``: The name of the file to delete from. For AppVars, the name should be preceded by the ``rowSwap(`` token.
214
+
215
+
Returns:
216
+
* Deletes the specified number of bytes from the specified file.
217
+
218
+
Errors:
219
+
* ``..E:NT:FN`` if ``byte_start`` is past the end of the file, or the number of bytes deleted would exceed the end of the file.
220
+
221
+
------------
222
+
223
+
.. function:: HexToBin: det(41); Ans = hex string
224
+
225
+
Outputs the binary equivalent of the input string in ``Ans``. For example, if you did this::
226
+
227
+
:"464F4F424152
228
+
:det(41)
229
+
230
+
The result would be ``"FOOBAR"``.
231
+
232
+
Parameters:
233
+
* ``Ans``: Hex string to convert.
234
+
235
+
Returns:
236
+
* ``Str9``: The converted string.
237
+
238
+
Errors:
239
+
* ``..INVAL:S`` if there is not an even number of characters in the string or an invalid hex character is present.
240
+
241
+
------------
242
+
243
+
.. function:: BinToHex: det(42); Ans = token string
244
+
245
+
Outputs the hex equivalent of the input string in ``Ans``. For example, if you did this::
Replaces the byte at ``target_byte`` of the specified string with the byte specified by ``replace_byte``. ``target_byte`` is 0-indexed, meaning that the first byte of the program is 0, the second is 1, and so on. For example::
269
+
270
+
:det(44, 0, 0, 255)
271
+
272
+
This code will replace byte 0 of ``Str0`` with the byte 255 in decimal, or 0xFF in hex.
273
+
274
+
Parameters:
275
+
* ``string_number``: The string to modify. 0 is ``Str0``, 1 is ``Str1``, and so on.
276
+
* ``target_byte``: The byte of the string to modify. It is 0-indexed, so the first byte of the file is 0, the second is 1, and so on.
277
+
* ``replace_byte``: The byte to replace the target byte with, in decimal format. Can be 0 - 255 (0x00 - 0xFF).
278
+
279
+
Returns:
280
+
* Replaces the target byte of a string with the specified replacement byte.
281
+
282
+
Errors:
283
+
* ``..E:NT:FN`` if the target byte does not exist in the string.
Copy file name to clipboardExpand all lines: docs/csefunctions.rst
+26-26Lines changed: 26 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ These functions are the same as those included in Doors CSE 8 for the TI-84 Plus
8
8
Documentation
9
9
~~~~~~~~~~~~~
10
10
11
-
.. function:: ReadLine: det(0), Str0 = variable name, Ans = line number
11
+
.. function:: ReadLine: det(0); Str0 = variable name; Ans = line number
12
12
13
13
Reads a line from a program or AppVar. If ``Ans`` (line number) equals 0, then Theta will be overwritten with the number of lines in the program being read. Otherwise, ``Ans`` refers to the line being read.
14
14
@@ -28,7 +28,7 @@ Documentation
28
28
29
29
------------
30
30
31
-
.. function:: ReplaceLine: det(1), Str0 = variable name, Ans = line number, Str9 = replacement
31
+
.. function:: ReplaceLine: det(1); Str0 = variable name; Ans = line number; Str9 = replacement
32
32
33
33
Replaces (overwrites) a line in a program or AppVar. ``Ans`` refers to the line to replace.
34
34
@@ -45,7 +45,7 @@ Documentation
45
45
46
46
------------
47
47
48
-
.. function:: InsertLine: det(2), Str0 = variable name, Ans = line number, Str9 = contents
48
+
.. function:: InsertLine: det(2); Str0 = variable name; Ans = line number; Str9 = contents
49
49
50
50
Insets a line into a program or AppVar. ``Ans`` refers to the line number to write to.
51
51
@@ -71,11 +71,11 @@ Documentation
71
71
Stores the ``->`` and ``"`` characters into ``Str9``.
72
72
73
73
Returns:
74
-
* ``Str9``: ``->`` and ``"``, respectively. You can use substrings to extract them. There are also 7 more characters in ``Str9``, which are junk.
74
+
* ``Str9``: ``->`` and ``"``, respectively. you can use substrings to extract them. There are also 7 more characters in ``Str9``, which are junk.
75
75
76
76
------------
77
77
78
-
.. function:: CreateVar: det(4), Str0 = variable name
78
+
.. function:: CreateVar: det(4); Str0 = variable name
79
79
80
80
Create a program or AppVar given a name.
81
81
@@ -94,7 +94,7 @@ Documentation
94
94
95
95
------------
96
96
97
-
.. function:: ArcUnarcVar: det(5), Str0 = variable name
97
+
.. function:: ArcUnarcVar: det(5); Str0 = variable name
98
98
99
99
Archive/unarchive a program or AppVar given a name.
100
100
@@ -106,7 +106,7 @@ Documentation
106
106
107
107
------------
108
108
109
-
.. function:: DeleteVar: det(6), Str0 = variable name
109
+
.. function:: DeleteVar: det(6); Str0 = variable name
110
110
111
111
Delete a program variable or an AppVar given a name.
112
112
@@ -118,7 +118,7 @@ Documentation
118
118
119
119
------------
120
120
121
-
.. function:: DeleteLine: det(7), Str0 = variable name, Ans = line number
121
+
.. function:: DeleteLine: det(7); Str0 = variable name; Ans = line number
122
122
123
123
Deletes a line from a program or AppVar. ``Ans`` is the line to delete.
124
124
@@ -131,7 +131,7 @@ Documentation
131
131
132
132
------------
133
133
134
-
.. function:: VarStatus: det(8), Str0 = variable name
134
+
.. function:: VarStatus: det(8); Str0 = variable name
135
135
136
136
Output status string describing a program or AppVar's current state, including size, visibility, and more.
Draws indexed (palette-based) sprite onto the LCD and into the graph buffer. Copies the contents of the graph buffer under the sprite back into Str9, so that you can "erase" the sprite back to the original background. Good for moving player characters, cursors, and the like. Interacts politely with Pic variables and OS drawing commands like ``Line(``, ``Circle(``, ``Text(``, and so on. If you want to draw a lot of different sprites to the screen and won't need to erase them back to the background, then use BufSpriteSelect instead.
155
155
156
156
Parameters:
157
157
* ``Str9``: Sprite data as ASCII hex, one nibble per byte. The digits 1-F are valid colors (1 = blue, 2 = red, 3 = black, etc), while G will cause the routine to skip to the next line. 0 is normal transparency, and lets the background show through. H is a special kind of transparency that erases back to transparency instead of leaving the background color intact.
158
-
* ``X``: X coordinate to the top-left corner of the sprite.
159
-
* ``Y``: Y coordinate to the top-left corner of the sprite.
158
+
* ``x``: x coordinate to the top-left corner of the sprite.
159
+
* ``y``: y coordinate to the top-left corner of the sprite.
160
160
* ``width``: Sprite width (height is computed).
161
161
162
162
Returns:
163
-
* ``Str9``: Same length as input, contains the previous contents of the graph buffer where the sprite was drawn. You can call ``det(9...)`` again without changing Str9 to effectively undo the first sprite draw.
163
+
* ``Str9``: Same length as input, contains the previous contents of the graph buffer where the sprite was drawn. you can call ``det(9...)`` again without changing Str9 to effectively undo the first sprite draw.
164
164
165
165
Errors:
166
166
* ``..INVAL:S`` if the string contains invalid characters.
167
167
168
168
------------
169
169
170
-
.. function:: BufSpriteSelect: det(10, width, X, Y, start, length), Str9 = sprite data
170
+
.. function:: BufSpriteSelect: det(10, width, x, y, start, length); Str9 = sprite data
171
171
172
172
Draws indexed (palette-based) sprite onto the LCD and into the graph buffer. Good for drawing tilemaps, backgrounds, and other sprites that you won't want to individually erase. If you want to be able to erase the sprite drawn and restore the background, you should consider BufSprite instead. This routine takes an offset into Str9 and a sprite length as arguments, so that you can pack multiple sprites of different lengths into Str9.
173
173
174
174
Parameters:
175
175
* ``Str9``: Sprite data as ASCII hex, one nibble per byte. The digits 1-F are valid colors (1 = blue, 2 = red, 3 = black, etc), while G will cause the routine to skip to the next line. 0 is normal transparency, and lets the background show through. H is a special kind of transparency that erases back to transparency instead of leaving the background color intact.
176
-
* ``X``: X coordinate to the top-left corner of the sprite.
177
-
* ``Y``: Y coordinate to the top-left corner of the sprite.
176
+
* ``x``: x coordinate to the top-left corner of the sprite.
177
+
* ``y``: y coordinate to the top-left corner of the sprite.
178
178
* ``width``: Sprite width (height is computed).
179
179
* ``start``: Offset into ``Str9`` of the start of pixel data, begins at 0.
180
180
* ``length``: Length of sprite data in characters.
@@ -187,7 +187,7 @@ Documentation
187
187
188
188
------------
189
189
190
-
.. function:: ExecArcPrgm: det(11, function, temp_prog_number), Ans = program name
190
+
.. function:: ExecArcPrgm: det(11, function, temp_prog_number); Ans = program name
191
191
192
192
Copies a program to the ``XTEMP`` program of the specified ``temp_prog_number``. ``Ans`` is the name of the program to copy. ``function`` refers to the behavior of the ``ExecArcPrgm`` command, as seen in the table below:
Changes the foreground and background color for ``Output(``, ``Disp``, and ``Pause`` to arbitrary 16-bit colors, or disables this feature. Due to technical limitations, the foreground and background for ``Text()`` cannot be changed to arbitrary colors. To disable this mode, you should call ``det(12, 300)`` before exiting your program.
218
218
219
219
Parameters:
220
-
* ``FG_LO``: low byte of foreground color.
221
-
* ``FG_HI``: high byte of foreground color.
222
-
* ``BG_LO``: low byte of background color.
223
-
* ``BG_HI``: high byte of background color.
224
-
225
-
Alternative method: ``det(12, FG_OS, BG_OS)``
226
-
* ``FG_OS``: Foreground color from TI-OS Colors menu, like RED or BLUE or NAVY.
227
-
* ``BG_OS``: Background color from TI-OS Colors menu, like RED or BLUE or NAVY.
220
+
* ``fg_low``: low byte of foreground color.
221
+
* ``fg_high``: high byte of foreground color.
222
+
* ``bg_low``: low byte of background color.
223
+
* ``bg_high``: high byte of background color.
224
+
225
+
Alternative method: ``det(12, fg_os, bg_os)``
226
+
* ``fg_os``: Foreground color from TI-OS Colors menu, like RED or BLUE or NAVy.
227
+
* ``bg_os``: Background color from TI-OS Colors menu, like RED or BLUE or NAVy.
228
228
229
229
Colors:
230
230
* A list of colors can be found `here <colors.html>`__.
0 commit comments