Jump to:
c99 - displaying characters on screen ||
c99 - Books to help with ||
c99 - Review
Editor Assembler Module Menu: LIST quirk
Extended Basic: Using PRESCAN with FOR...NEXT ||
Even faster SIN calculation
Pilot 99 - displaying characters on screen
TI Forth: Using Arrays ||
Copying disks
TI Logo - Heart procedure
TI USCD Pascal- note re SYSTEM.LIBRARY ||
TI USCD Pascal- Disc copying
Visiting Myarc
The magazine included news of the next meeting of UK owners to be held on 3rd May from 10am to 5pm at Centenary House, Leeds.
There was an advert for the Prestel service Micronet 800, which was available to UK TI owners either using local numbers - requiring a 1200/75 baud modem, a program from the User Group, 32k ram and a disk drive, or could be accessed at 300 baud using the TE2 module and a London telephone number. Quarterly subscription was GBP 16.50 and it supported mailboxes (for mail between subscribers). The service was closed in 1991 and subscribers moved to Compuserve (subsequently AOL).
Only ONE heart routine submitted, from Graham...
TO HEART :SIZE
LT 64
REPEAT 24 [FD :SIZE * 2 RT 3]
REPEAT 35 [FD :SIZE RT 5]
RT 180
REPEAT 35 [FD :SIZE RT 5]
REPEAT 24 [FD :SIZE * 2 RT 3]
END
Try HEART 2, 3 or 4.
TI FORTH is an implementation of Fig-Forth. fig-Forth does not contain the word CREATE, but the standard Forth 79 word CREATE... DOES have a direct equivalent in fig-Forth's BUILDS... DOES
The TI Forth word CREATE is peculiar to TI Forth and has no correspondence with the word CREATE in either the Forth 79 standard or the Polyforth word used by Scanlon.
On pages 127 to 130 of FORTH PROGRAMMING by Leo J
Scanlon (SAMS ISBN 0 672 22007 5) some ARRAY routines
are provided and are worth trying...
First lets define a word, ARRAY:
: ARRAY <BUILDS 2 * ALLOT DOES> SWAP 2 * + ;
And let's use it to create an array called ITEMS with
space for 10 numbers (eg 20 bytes total):
10 ARRAY ITEMS
To USE this array:
3500 8 ITEMS ! will store 3500 in element 8 of ITEMS
8 ITEMS @ . will print the contents of the 8th element of ITEMS.
8 ITEMS ? will do the same.
Examples:
Try ENTERing and RUNning:
100 J=1
110 REM
120 FOR J=1 TO 100 :: IF J/10=INT(J/10) THEN 130 :: NEXT J
130 PRINT J :: NEXT J
150 PRINT "DONE"
or
100 J=1
110 REM
120 FOR J=1 TO 100 :: IF J/10<>INT(J/10) THEN NEXT J
ELSE PRINT J :: NEXT J
There is nothing logically wrong with these short
listings, they just don't work. Can you see what they
are supposed to do?
Can you see how we can make them work, without having
to split the FOR...NEXT line up over several program
lines?
Simple .... in each example, replace the REM in line 110 with
!@P-
[ Shift 1, Shift 2, Shift P, Shift /, no spaces].
Now run again... and it works.
!@P- is the command to turn off prescan (the computer stops checking for errors before running the program).
You can (and should) turn it on again as soon as possible for example by adding:
140 !@P+
Thanks to Raoun hartinez and Orange County User Group
ROM Newsletter
I can't find a note of this in previous issues, and a phone call from a frustrated TI owner indicates we need to put it in. TI in Bedford could not help him. Parco could not help him but passed on my phone number... thanks guys!:
Using Editor Assembler module's menu, when you select the LIST option, you may enter a file name, either a printer filename or a disk filename.
If you enter RS232.BA=1200 no problem. However if, like so many of us, you use PIO and just enter PIO a disaster occurs: the module throws a DSR ERROR at you!
The solution is to add a full stop after the PIO so your file name is PIO.
Call it a bug if you will - when the module was released TI did not have a parallel interface and seem to have expected all file names to have a full stop in then - presumably separating the DEVICE name from the modifiers.
TI's DISK MANAGER I module could very happily copy Forth disks, but unfortunately Disk Manager 2 does not: after "copying" with TI Disk Manager 2. you must then use Forth itself to copy Screens 1 to 9. To do this use:
Insert master disk in drive 1
1 BLOCK UPDATE 2 BLOCK UPDATE 3 BLOCK UPDATE 4 BLOCK
UPDATE 5 BLOCK UPDATE
Now insert "copied" disk:
FLUSH
Now insert 'master' disk:
6 BLOCK UPDATE 7 BLOCK UPDATE 8 BLOCK UPDATE 9 BLOCK
UPDATE
Insert 'copied' disk:
FLUSH.
OR use Forth entirely:
Master disk in Drive 2, blank initialised disk in
Drive 1:
0 DISK_LO ! FORTH-COPY
(assumes -COPY has been loaded)
360 DISK_SIZE !
n DISK_HI ! [n=number of drives you have at 360]
Forth will now recognise your disk as having 360
screens (180 on each side).
ii.Edit Screen 40:
Line 3: Change 168 to 5A0
Line 4: Change 944 to 1244
Line 5: Replace line with:
DUP 10 + 2028 SWAP ! DUP 12 + 0202 SWAP ! DUP 14 +
24 0 FILL
Line 10: Change 165 to 59D
Line 13: Change 4016 to C059
Now edit Screen 33. and modify FORMAT-DISK to read:
: FORMAT-DISK 1+ 514 33616 ! 18 SYSTEM ;
All that is left is to modify the header sectors. This
is done with a little Forth program. Make sure the
"copy" disk is in drive one.
In immediate mode type in:
HEX 0 DISK_LO !
The new header is easily copied either by using
FORTH-COPY or by copying Screens 0 and 1 onto future
Forth disks.
: DD 0 BLOCK UPDATE
DUP A + 5A0 SWAP ! DUP C + 1244 SWAP !
DUP 10 + 2028 SWAP ! DUP 12 + 202 SWAP !
38 + C8 FF FILL 1 BLOCK UPDATE
DUP E + 570 SWAP ! DUP 1C + 4D20 SWAP !
DUP 1E + 5205 SWAP ! 20 + F059 SWAP !
FLUSH ; DECIMAL DD
Jiml Vincent/ 99ers Users Group Association/September
1984
Because installation of a new UNIT into a
SYSTEM.LIBRARY requires that a file be open while data
is manipulated, the existing SYSTEM.LIBRARY data is
quite vulnerable. TI added protection.
You need to
call a temporary File -say USER.LIB. transfer all UNITS
in SYSTEM.LlBRARY to USER.LIB, then add your new UNITS
to USER.LIB and IF all goes well, rename the USER.LIB
file SYSTEM.LIBRARY
TI were really being quite thoughtful
Please refer to page l6 of TI*MES issue 10:
A faster still BASIC SIN routine is possible:
100 INPUT A
Now compare the time this routine takes compared to
PRINT SIN(A).
110 PRINT A*(1+A*A*(0.0076
*A*A-0.166))
120 GOTO 100
As before A should fall between 0 and 1.7
If you transfer this routine to machine code. and use it instead of the inbuilt SIN function, you should see some much faster graphics where SIN is used.
Thanks to John Stocks for this. John points out that mathematically, the two constants in the equation SHOULD be 0.16666 and 0.0084 - but once past A=1.118, the values given above actually give more accurate results.
Or... what does it look like?
This issue of RAMBLES has a little Forth, Basic, and Logo, but there are other languages too. Taking a brief look at sample listings may help you decide you would like a closer look, so here goes.
/* Malcolm's test program 1 */
#include dsk1.conio
int row,col;
main()
{ while(1)
{ row=0
putchar(FF);
while(++row<25)
{ col=6;
while(++col<35)
{ locate(row,co1);
putchar(42};
}
}
if(getchar()<1) break;
}
}
This code is COMPILED by the C99 program into 9900 source code which you can then assemble into your desired format with Editor/Assembler. Naturally,
machine code is quite fast Notice that the variables row and col are DECLARED as INTEGERS before we use them. PUTCHAR places a single character on the screen - FF is predefined in the CONIO file as "clear screen and home cursor to top left".
The double plus sign acts to increment the variable while locate merely locates the cursor.
C99 is based on the 40 column screen
c99 is available on my download page
IT:
R: Clear 32 col screen. Cursor to top left
LP: 24
R: LOOP 24 times
TH: :42:
R: Type and Hang
EL:
R: end loop
E:
( the END statement E: is essential!)
All we have done is fill a screen with asterisks!
This program will backup any disk using sector I/O; both 1 and multiple drives and single/double sided. Written in UCSD Pascal for the TI 99/4A.
Taken from a US Bulletin Board
{$L PRINTER: }
program fastback;
buffer:array[1..5120] of integer;
inunit,outunit:integer;
blkbase,blklimit:integer;
ch:string[9];
procedure getfrom;
begin
inunit:=0;
while (inunit,.4) and (inunit,.<>5)
and (inunit<>9) do
begin
write('Enter Source Drive # (4,5,9) '?');
readln(inunit)
end;
blkbase:=0;
while (blkbase<>180) and
(blkbase <> 360) do
begin
write('# blocks to copy (180/360) ?')
readln(blkbase)
end;
blklimit:=(blkbase div 10) - 1;
end;
procedure getto;
begin
outunit:=0;
while (outunit<>4) and
(outunit<>5) and (outunit<>9) do
begin
write('Enter Copy Drive # (4,5,9) ?');
readln(outunit)
end
end;
beqin
writeln('FASTBACK [V1,0]');
qetfrom;
getto;
writeln('insert disks--<cr> to start');
readln(ch);
for blkbase:=0 to blklimit do
begin
if inunit=outunit then
beqin
write( ' Insert MASTER disk--press
<cr> when ready');
readln(ch)
end;
unitread(inunit,buffer,5120,blkbase*10);
if inunit=outunit then
begin
write('Insert COPY disk--Press
<cr> when ready');
readln(ch)
end;
unitwrite(outunit,buffer,5120,blkbase*10)
end;
write1('Copy Complete.')
end.
Although C99 is only a subset of a subset of C, books on sale cover the whole C language - not to worry. all the bits we have are covered, and the rest nay be added later!
I found two types of tuition guide to C - one type assumed you had knowledge of a UNIX operating system- not a lot of good to us!
The other type worked by comparison to BASIC programs
I found a book in the January sales at one third cover price:
PROGRAMMING IN C FOR THE MICROCOMPUTER USER by Robert J Traister. Published by Prentice Hall. ISBN 0-13-729641-X. 190 pages.
As this may not now be readily available. a similar book can be found in: C PROGRAMMING GUIDE by Jack Purdue, published by Que ISBN 0-88022-022-8. 250 pages.
Both books unfortunately start with PRINT and FOR...NEXT, not currently available with C99REL1. C99 does support PUTS and PUTCHAR. as well as WHILE. The main difference between PUTS and PRINTF is that PRINTF permits formatting commands whereas PUTS does not.
Samples:
The Que book advises that printf generates more code than puts, and puts is to be preferred if the special provisions of printf are not required.
puts("\nEntry was a diqit")
printf("\nEntry was a digit")
have the same effect!
A complex use of printf would be
printf("x=%d and y=%d", 5, 8)
which could not easily be done using puts
If you can get hold of at least the book by Jack Purdham. then together with the documentation supplied with C99, you should be able to write possibly your first 'machine code' program.
c99 release 4 is available on my download page I am certainly going to write to Clint and even going to enclose a money order.
As I obtained it the programs and tiles are contained on two single sided disks. They all fit with a bit of spare space onto a double sided disc. The original release fitted on a single sided disc but Clint decided to issue some source files and one or two other programs and utilities also. In order to write C99 programs you need an Editor, either the one supplied in the E/A package or TIW. If you use TIW you must save the file by using the Print option and naming a disc file as destination. (This avoids the problems caused by the format information included. when you save TIW files in the usual way.).
It is also necessary to be able to assemble 9900 assembly language source. Obviously the most convenient system is the Editor/Assembler module and its software. However it is possible to run that software using either MM or XB. You need special programs which are also available on the Freeware system.
( ss: At the present time, C99 will only run from the Editor/Assembler module. It is coded very tightly - including routines in scratchpad ram for speed and makes direct access to routines in the Editor Assembler GROM. A version for XB may appear later... keep tuned... ....ss)
The first step in writing a C99 program is to write the C99 source using an Editor and save it. As well as C99 source you can instruct the compiler to include other files and the library functions provided. Then using option 5 of the E/a module you run the c99 compiler. This writes 9900 assembly language source statements to a file of your choice.
[That was not a misprint.. think about that idea ] It can be convenient to let the output go to the screen as you check the program for errors. However the usual destination is a disc file. One option is to include the C99 source in this assembly language file as comments. Having done this and hopefully avoided errors, you now run the assembler against the file you have just produced with the compiler.
The usual assembler options are available although you never need to specify the R option. You can now run your program. First it is necessary to load CSUP, a C99 support file, any other library files that may be needed (perhaps for file handling), and then load your object file. This is with the E/a option 3. The program name is always START in these programs. At this stage we can hope that our program works as expected.
There is a full explanation of how to run the system on the release disc and a brief explanation of how the system was implemented. Two text books are recommended and I would add 'The Small-C Handbook' by James E. Hendryx to the list. The documentation does not try to teach the C language but there are several source files which are well commented and are useful as examples.
There are a number of utilities on the first disk. One tor locating compiler errors is of obvious use in developing programs. There is one undocumented utility. It is called OPT and appears, from comments in the source, to be a code optimiser. That is it reads the output from the compiler and chops out duplicated code. This shortens the files for assembly and could he vital if a large application is being attempted.
I have used it and it worked and the optimised program still ran. Clint has included a disk directory program which works extremely quickly and can be useful within the E/A environment.
Also provided are two files that permit us to save our working programs in program format. This is explained a little obscurely in the manual but I have managed to make that work.
One thing that struck me as peculiar was the fact that for one small program l ended up with three large program format files. However Stephen assures me that there is nothing to worry about. Apparently the program reserves large areas of memory when running, this affects the way the Save utility works.
This useful program means that it should be possible to write C99 programs and save the runnable versions to tape. ( ss. yes you can and it works. And we have a public domain program which enables ExBas to load these cassette files too .... ss).
With the availability of loaders for XB and MM we can see greater prospects of machine programs tor the unexpended machine. The second disk contains a source file tor the directory program on the first disk and the source and object for a TIW loader for the MM module.
Also included are XB and MM,E/A versions of a BREAKTHROUGH game that is well documented and very entertaining.
I certainly enjoyed playing with it though l usually find adventure games are more my style.
To move on to a C99 application which is supplied on the second disk. This is the source and object code for a text formatter.
The program is called RUNOFF and allows the printing of TIW files and other DV80 text files without the need for embedded commands. It works nicely and lets you offset tables within the text in nofill mode.
(ss... RUNOFF has a significant advantage over TIW: the text tile is not stored in console ram, so a text file of 300 sectors may be printed : useful if you have created a mammoth text file by downloading from a bulletin board.
This version of Small-C does not have some of the usual features but it is likely that later revisions will have. I am sure that a positive response to Clint Pulley from some of the people who obtain this program will ensure further development. Stan Dixon.
Several thousand programs for PC99 can be found on the inexpensive DVD-rom from CaDD Electronics, The Cyc, programs plus huge amounts of documentation, many books and manuals - all legally copied and reformatted in searchable form, - considerable effort. Includes legal copies of all TI modules in PC99 format, including the much sought Tunnels of Doom module. VAT and post office collection charges are payable on delivery in the UK.
Might look costly but a huge amount of work has gone into it- Look at the quality of Cyc content here. Note that Mike only checks his emails every week or so!
[ TI Book front page |
TI Resources Page
| TI Articles
| PC99 and MESS Programs
]