Difference between revisions of "Programming"

From Ninerpedia
Jump to navigation Jump to search
m (modified internal link to TI ExBas)
m
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
See article [[Programming languages]]
== Environments ==
== Environments ==


* [[Programming in MDOS|MDOS]]
* [[Programming in MDOS|MDOS]]


== BASIC and its extensions ==
See article [[Programming languages]]


The well-known foundation of programming on the TI-99/4A were the built-in [[Using_the_system#Using_TI_BASIC |TI BASIC]] and the cartridge-based  TI [[Extended BASIC]]
This article contains some additional information relating to Extended BASIC
.


The installed TI BASIC Language conformed to the ANSI Standard for Minimal BASIC (X3.60-1978).  
== BASIC and its extensions ==
The Myarc and the CorComp disk controllers added a number of additional support routines to the language.


Several arcane versions of the BASIC dialect added additional commands to it.
== Extended Basic Extensions==
Very few programs were ever written to take advantage of the additional commands hidden in some of those cartridges (most notable here is the Personal Record Keeping cartridge), while others had considerable effort devoted to them (TI Extended BASIC being a great favorite). 
CALL LOAD requires Expansion Memory.
 
There were many third-party extensions of TI Extended BASIC. 
 
* Mechatronics [[Extended BASIC II+]] incorporated the APESOFT Expanded Graphics routines into their version of the cartridge.
* Triton included many additional commands in their Super Extended BASIC
* Winfried Winkler included many additional commands in [[Extended BASIC III]] (in extremely limited release by Asgard, but generally only available as a set of files for the HSGPL card)
* [[Myarc Extended BASIC II]] included many of the commands originally planned for inclusion in TI Extended BASIC II (as seen on the [[TI-99/8]])
 
Rich Gilbertson devised the most recent extended version of the TI Extended BASIC dialect, [[RXB]], which is generally available as a set of program images for a GROM emulation device.
 
The Myarc and the CorComp disk controllers added a number of additional support routines to the language.


=== Useful CALL LOADs ===
=== Useful CALL LOADs ===
Also see article on using [[Sound with CALL LOAD]] and [[Speech#Using CALL LOADs for SPEECH|Speech with CALL LOAD]]


Other systems are known for their PEEKs and POKEs, but neither TI BASIC nor Extended Basic offer such commands. Instead, we have [[CALL subprograms]] that do a similar job, CALL PEEK and CALL LOAD. The LOAD subprogram is actually used to load [[tagged object code]] but it can also be used to set values in memory or devices.
Other systems are known for their PEEKs and POKEs, but neither TI BASIC nor Extended Basic offer such commands. Instead, we have [[CALL subprograms]] that do a similar job, CALL PEEK and CALL LOAD. The LOAD subprogram is actually used to load [[Tagged Object Code|tagged object code]] but it can also be used to set values in memory or devices.


* CALL LOAD(-31962,100,155)
* CALL LOAD(-31962,100,155)
Line 38: Line 32:


100, 136 is RESequence. This will renumber all BASIC lines (here by default start 100, increment 10)
100, 136 is RESequence. This will renumber all BASIC lines (here by default start 100, increment 10)
* CALL LOAD(-31888,63,255) then NEW
..equivalent of CALL FILES(0) ( Frees up another 250 odd bytes of memory from CALL FILES(1))
NB: Attempted disk usage after turning all drives OFF like this can be fatal!
* CALL LOAD(-31888,55,255) then NEW
...reverses above and gives you back three drives!


* CALL LOAD(-31962,160,04)  
* CALL LOAD(-31962,160,04)  
Line 96: Line 98:
If the Enable* bit is cleared (set to 1) we get no sprite and sound processing and QUIT key, but the VDP status is still being read and copied to >837B, the screen blanks after some time, and the interrupt counter is increased. Also, a user-defined ISR is served if registered at >83C4.
If the Enable* bit is cleared (set to 1) we get no sprite and sound processing and QUIT key, but the VDP status is still being read and copied to >837B, the screen blanks after some time, and the interrupt counter is increased. Also, a user-defined ISR is served if registered at >83C4.


=== Pre-scan control ===
==Extended Basic Tips==
 
Please refer to the [[Extended BASIC#Programming Hints|Extended BASIC]] article
Pre-scan is used to allocate memory before the BASIC program starts. It causes a notable pause before the first statement executes, because the pre-scan process scans the whole program for variables and subprograms. Extended Basic allows for a quicker start-up by turning pre-scan off and on; these lines are specific comment lines.
 
100 GOTO 150
110 A=0 :: B$=""
120 DATA 1
150 !@P-
 
turns off pre-scan after line 150


200 !@P+
== Other [[Programming languages]] ==


turns it on after line 200. Pre-scan is enabled by default.
See main article on [[Programming languages]]
 
Pre-scan must be active for the following program parts:
 
* The first DATA statement
* The first use of a variable or an array
* OPTION BASE (if used)
* Reference to each subprogram called in the program
* DEFs
* SUB and SUBEND
 
Variables introduced in the SUB statement (formal arguments) are locally valid, so they must be included. CALLs in the pre-scan need not list actual arguments. You do not need to build correct assignments to variables either. However, the lines must not be executed, or an error will occur.
 
100 GOTO 150
110 CALL SCREEN :: CALL MYOWNSUB :: CALL CLEAR :: A,B,C=D :: E :: NAME$ :: !@P-
120 DATA 10
150 CALL CLEAR
160 REM REST OF PROGRAM
 
== Other Programming Languages ==
 
* Pascal, as [[Pascal#UCSD_Pascal_System|UCSD Pascal]] and [[Pascal#Turbo_Pasc'99|Turbo Pasc'99]]
* FORTH, as [[TI FORTH]] and [[FIG Forth 2.0]] (M. Weiand)
* FORTRAN, as [[FORTRAN 9640]]
* C, as [[C99]], [[C99 MDOS]], and [[TIC]]
* [[TI Logo]]
* [[TI Logo II]] (available with the commands localized into several different languages, providing several different versions of the same cartridge)


== Assembly programing ==
== Assembly programing ==
Line 143: Line 111:


See also the [[Programming FAQ]]
See also the [[Programming FAQ]]
[[Category:Programming| ]]

Latest revision as of 21:29, 10 July 2016

See article Programming languages

Environments

See article Programming languages

This article contains some additional information relating to Extended BASIC .

BASIC and its extensions

The Myarc and the CorComp disk controllers added a number of additional support routines to the language.

Extended Basic Extensions

CALL LOAD requires Expansion Memory.

Useful CALL LOADs

Also see article on using Sound with CALL LOAD and Speech with CALL LOAD

Other systems are known for their PEEKs and POKEs, but neither TI BASIC nor Extended Basic offer such commands. Instead, we have CALL subprograms that do a similar job, CALL PEEK and CALL LOAD. The LOAD subprogram is actually used to load tagged object code but it can also be used to set values in memory or devices.

  • CALL LOAD(-31962,100,155)

This is address >8326; loading the values 100, 155 at those locations makes the interpreter run the program (RUN).

  • CALL LOAD(-31952,255,231,255,231)

Resets the pointers at >8330 and >8332 to FFE7 and FFE7, which wipes the program in memory (effectively a NEW).

  • CALL LOAD(-31962,100,136)

100, 136 is RESequence. This will renumber all BASIC lines (here by default start 100, increment 10)

  • CALL LOAD(-31888,63,255) then NEW

..equivalent of CALL FILES(0) ( Frees up another 250 odd bytes of memory from CALL FILES(1)) NB: Attempted disk usage after turning all drives OFF like this can be fatal!

  • CALL LOAD(-31888,55,255) then NEW

...reverses above and gives you back three drives!


  • CALL LOAD(-31962,160,04)

This will execute RUN without pre-scan

  • CALL LOAD(-31961, 149)

Automatic RUN DSK1.LOAD

  • CALL LOAD(-31931,0) and CALL LOAD(-31931,128)

Address >8345; turns off and on Extended Basic list protection. Only the leftmost bit is significant, so all values 0-127 are treated as 0 and 128-255 are treated as 1.

  • CALL PEEK(2,a,b):: CALL LOAD(-31804,a,b)

At location >0002 we have the program counter component of the RESET vector (usually >0024). -31804 is the address >83C4, which is the pointer to the user-defined interrupt routine. In other words, this will make the system execute a QUIT at the next interrupt. Caution: This is equivalent to pressing FCTN-=, not to entering BYE.

  • CALL PEEK(-31877,A)

At >837B (this address) we find a copy of the VDP status register which is copied there by the console interrupt service routine (ISR).

  • CALL PEEK(-31879,A)

Address >8379 contains a byte value that is incremented on each VDP interrupt (wraps at 255 back to 0)

  • CALL PEEK(-31878,A) / CALL LOAD(-31878,A)

Address >837A is the highest number of a sprite in auto-motion. You can query the number with CALL PEEK, and you can also modify it with CALL LOAD, which will cause higher sprites to stop auto-motion.

  • CALL LOAD(-31806,A)

>83C2 is a flag byte that is read by the console ISR. It is built up like this:

0 1 2 3 4 5 6 7
Enable* Sprite motion* Sound* Quit key* 0 0 0 0

(* indicated negative logic, means that the feature is on with a 0 bit and off with a 1 bit)

Accordingly we get the following settings:

A=64 (01000000): Disable sprite motion

A=0 (00000000): Enable all

A=16 (00010000): Disable QUIT key

If the Enable* bit is cleared (set to 1) we get no sprite and sound processing and QUIT key, but the VDP status is still being read and copied to >837B, the screen blanks after some time, and the interrupt counter is increased. Also, a user-defined ISR is served if registered at >83C4.

Extended Basic Tips

Please refer to the Extended BASIC article

Other Programming languages

See main article on Programming languages

Assembly programing

See also the Programming FAQ