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
+146Lines changed: 146 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -281,3 +281,149 @@ Documentation
281
281
282
282
Errors:
283
283
* ``..E:NT:FN`` if the target byte does not exist in the string.
284
+
285
+
------------
286
+
287
+
.. function:: ErrorHandle: det(45); Ans = program to run
288
+
289
+
Executes BASIC code with an error handler installed. That means the code you execute can do anything it wants including divide by zero, and it will simply end the execution but an obvious system error will not trigger. Instead, this command will return with a value that indicates the error condition. This command has two different modes. If ``Ans`` contains a program name (beginning with the ``prgm`` token), it will run that program. If ``Ans`` contains program code, it will execute that code instead. This will also work with programs beginning with the ``Asm84CEPrgm`` token.
290
+
291
+
A list of return values and their corresponding errors can be found in the `error codes <errorcodes.html#ti-os-errors>`__ section, under TI-OS Errors.
292
+
293
+
.. note:: When using ErrorHandle from the homescreen, it will not run BASIC programs, though it can still run programs beginning with the Asm84CEPrgm token.
294
+
295
+
Parameters:
296
+
* ``Ans``: The name of the program to run, or TI-BASIC code to be executed
297
+
298
+
Returns:
299
+
* ``Theta``: Contains the error code returned by the program, or 0 if no error occured.
300
+
301
+
Errors:
302
+
* ``..NULLVAR`` if the program is empty.
303
+
* ``..SUPPORT`` if the file is not a TI-BASIC program.
Works almost identically to BASIC's sub() command, except that the output will be in hexadecimal and two-byte tokens will read as two instead of one byte. It is particularly useful for extracting data from a string that may contain nonsensical data that simply needs to be manipulated. If you allow the start point to be zero, the size of the string in bytes is returned instead. For data manipulation, you should use the Edit1Byte command.
310
+
311
+
Parameters:
312
+
* ``string``: Which string variable to read from, where 0 = Str0, 9 = Str9, and so on
313
+
* ``start``: The byte of the string to begin reading at
314
+
* ``bytes``: How many bytes to read
315
+
316
+
Returns:
317
+
* ``Str9``: The extracted substring.
318
+
* ``Theta``: The size of the string in bytes, if ``start`` was 0.
319
+
320
+
------------
321
+
322
+
.. function:: HexToDec: det(47); Ans = hex
323
+
324
+
Converts up to 4 hex digits back to decimal. If you pass a string longer than 4 digits, only the first four are read.
325
+
326
+
Parameters:
327
+
* ``Ans``: Hex string to convert
328
+
329
+
Returns:
330
+
* ``Theta``: Decimal integer converted from hex string.
331
+
332
+
Errors:
333
+
* ``..INVAL:S`` if an invalid hex digit is passed.
334
+
335
+
------------
336
+
337
+
.. function:: DecToHex: det(48, number, override)
338
+
339
+
Converts a number between 0 and 65535 to its hexadecimal equivalent. The number of hexadecimal output to the string will have its leading zeroes stripped so inputting 15 will result in “F” and 16 will result in “10”. If override is 1, it will output all leading zeroes, which may be useful for routines that require four hex digits at all times but cannot spend the memory/time whipping up a BASIC solution to fill the missing zeroes.
340
+
341
+
Parameters:
342
+
* ``number``: Decimal integer to convert
343
+
* ``override``: 1 to output all leading zeroes, or 0 to not
344
+
345
+
Returns:
346
+
* ``Str9``: Hex string converted from decimal integer.
This command, otherwise, works just like Edit1Byte. Its documentation is rewritten here for convenience. Replaces a word in some string variable, Str0 to Str9, with a replacement value 0 through 65535 starting at some specified byte (start is at 0). The string supplied is edited directly so there's no output. See Edit1Byte for more details.
353
+
354
+
The replacement is written in little-endian form and if the number is between 0 and 255, the second byte is written in as a zero.
355
+
356
+
.. note:: Note: A “word” in this sense is two bytes. Useful for editing a binary string which entries are all two bytes in length, such as a special string tilemap. You’re required, however, to specify offset in bytes. Also know that all words are stored little-endian. That means that the least significant byte is stored before the most significant byte is.
357
+
358
+
Parameters:
359
+
* ``string``: Which string variable to read from, where 0 = Str0, 9 = Str9, and so on
360
+
* ``start``: The byte to start editing in the string
361
+
* ``word``: The two bytes to rewrite
362
+
363
+
Returns:
364
+
* Modifies the string with the specified word
365
+
366
+
Errors:
367
+
* ``..E:NT:FN`` If the offset is past the end of the string
Performs a bitwise operation between value1 and value2 using a supplied function value. It will only work with up to 16-bit numbers.
374
+
375
+
The different functions are below:
376
+
377
+
===== ===========
378
+
Value Operation
379
+
===== ===========
380
+
0 NONE
381
+
1 AND
382
+
2 OR
383
+
3 XOR
384
+
4 Left Shift
385
+
5 Right Shift
386
+
===== ===========
387
+
388
+
If the numbers are out of bounds, then the function will exit out with an error. This command really helps mask out hex digits but if you use strings to store those digits, you'll need to use the HexToDec command for each value you need.
389
+
390
+
Parameters:
391
+
* ``value1``: First value to perform bit operation with
392
+
* ``value2``: Second value to perform bit operation with
393
+
* ``function``: Which operation to perform, as seen in the table above
394
+
395
+
Returns:
396
+
* ``Theta``: Result of the bit operation.
397
+
398
+
------------
399
+
400
+
.. function:: GetProgList: det(51, type); Ans = search string
401
+
402
+
This function will return a space-delimited string consisting of the names of programs, appvars, or groups that match partial name of the search string. Which is to say::
403
+
404
+
"TEMP
405
+
det(51, 0)
406
+
407
+
would return all program names that start with the characters “TEMP”, which may be something like “TEMP001 " or “TEMP001 TEMP002 TEMP003 “, etc.
408
+
409
+
===== =========
410
+
Value File Type
411
+
===== =========
412
+
0 Programs
413
+
1 AppVars
414
+
2 Groups
415
+
===== =========
416
+
417
+
.. note::
418
+
This command is NOT to be confused with FindProg, which outputs a string consisting of files whose CONTENTS starts with the specified string. Also use the fact that the final name in the list is terminated with a space to make extracting names from the list easier. It also will not find hidden variables.
419
+
420
+
Parameters:
421
+
* ``type``: The type of file to search for, as seen above
422
+
* ``Ans``: String to find in file names
423
+
424
+
Returns:
425
+
* ``Str9``: Filtered list of files
426
+
427
+
Errors:
428
+
* ``..S:NT:FN`` if ``Ans`` is not a string
429
+
* ``..P:NT:FN`` if no files were found containing the search string
Copy file name to clipboardExpand all lines: docs/csefunctions.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Documentation
10
10
11
11
.. function:: ReadLine: det(0); Str0 = variable name; Ans = line number
12
12
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.
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, though it will still return the ``..NUMSTNG`` error, like the original Celtic 2 CSE. Otherwise, ``Ans`` refers to the line being read.
14
14
15
15
.. warning::
16
16
If you attempt to read the line of an assembly program, there is a risk of a reset. If Celtic passes an invalid token to ``Str9``, it could cause a RAM clear.
Copy file name to clipboardExpand all lines: docs/dcefunctions.rst
+1-4Lines changed: 1 addition & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,6 @@ Documentation
13
13
14
14
Displays colored text from ``Str9`` at ``x`` and ``y`` on the screen, using the OS large or small font.
15
15
16
-
.. warning::
17
-
you can only use a maximum of 128 characters in ``Str9`` at a time with this command. However, this should be plenty, since the text does not wrap.
18
-
19
16
Parameters:
20
17
* ``large_font`` = whether to use OS large or small font. 0 means to use the OS small font, and 1 means to use the large font.
21
18
* ``fg_low``: low byte of foreground color.
@@ -56,7 +53,7 @@ Documentation
56
53
57
54
------------
58
55
59
-
.. function:: TextRect: det(15, low, high, x, y, width, height)
56
+
.. function:: FillRect: det(15, low, high, x, y, width, height)
60
57
61
58
Draw a filled, colored rectangle on the screen. This command can also be used to draw an individual pixel by setting the width and height to 1, or a line by setting either the width or height to 1.
Copy file name to clipboardExpand all lines: docs/errorcodes.rst
+62-1Lines changed: 62 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,9 @@ Overview
6
6
7
7
Celtic does its best to prevent errors. However, if something goes wrong with running a function, Celtic will return an error code. This can be from lack of memory, an incorrect argument, or something else.
8
8
Keep in mind that Celtic might not always detect the exact error, or realize that there is one in the first place. You can use the error codes to help with the debugging process.
9
+
This page also contains TI-OS errors and the corresponding values returned in the ErrorHandle command.
Copy file name to clipboardExpand all lines: docs/gensyntax.rst
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ If you have entered a valid argument, Celtic will tell you what function the arg
15
15
16
16
Celtic's function preview feature.
17
17
18
-
The function preview follows a general syntax: "``CommandName(Arguments)``: ``Input Vars`` (if any): ``Output Vars`` (if any)". As you can see in the example above, ReadLine is listed with no arguments, ``Str0`` and ``Ans`` as the input variables, and ``Str9`` or ``theta`` as the output variables.
18
+
The function preview follows a general syntax: "``CommandName(Arguments)``: ``Input Vars`` (if any): ``Output Vars`` (if any)". As you can see in the example above, ReadLine is listed with no arguments, ``Str0`` and ``Ans`` as the input variables, and ``Str9`` or ``theta`` as the output variables. If no input variables are necessary (though there are still output variables), it will say "NA" instead. Nothing will be listed of there are no input and output variables.
19
19
20
20
.. note::
21
21
In the event that you pass invalid arguments to Celtic, it will return an error. All errors are returned in ``Str9``. See the `Error Codes <errorcodes.html>`__ page for more information.
@@ -53,6 +53,8 @@ When using ``Str0`` as a program name, simply store the name of the program into
53
53
54
54
If a string is used, it must be in the RAM when the function is called.
55
55
56
+
.. warning:: In almost all cases, Celtic will detect if you passed invalid arguments and return an error instead. However, in the (extremely) rare case that you tried to pass a string with the length of 0, it will not handle this. Don't worry, there shouldn't be any reason this would happen without you trying to make it happen.
57
+
56
58
Returns
57
59
~~~~~~~
58
60
Depending on the function, Celtic will return a value after it runs. For example, the ``SpecialChars`` function fills ``Str9`` with certain special characters.
0 commit comments