Programming

From Ninerpedia
Jump to: navigation, search

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