ticalc.org
Basics Archives Community Services Programming
Hardware Help About Search Your Account
   Home :: Archives :: News :: Feature: 68K Programming Guidelines

Feature: 68K Programming Guidelines
Posted by Nick on 26 April 2000, 01:42 GMT

François Revol, a French programmer, brings up some interesting points in our next feature, talking about establishing guidelines for coding in 68000 assembly.


Ti68k open programming guidelines

With the increasing number of z80 based TI calcs, we have come to an incredible list of shells, at least 3 for every model, each having it's own 'API'. Of course, some of them were designed to be compatible with others like CrASH for Ash... But it's far from ideal.

Of course, on the 68k scene, there are only 3 models (but how many ROM versions ? How many Hardwares ?) but it might change in the future... And don't count on TI engineers to help you to stay compatible...

One project that will help us (IMO) is [tie], which would allow to fill the gap between the Ti92 and the 92+/89 models... I think the most important function needed is heaplock, which must be in the ROM, but we need to locate it.

Another project that I think is the best thing that happened to the Ti68k world since Fargo is Prosit. Multitasking on the is a great and fun thing. And it's only the beginning.
The main reason Prosit isn't so popular is the fact it doesn't allow DoorsOs programs (games particularly) to be loaded (and so multitasked). The problem is DoorsOs progs, DoorsOs itself and TI'ROM aren't designed for that. The keyboard is the perfect example: every program reads the keyboard port directly.

The best design would be to isolate all hardware access in libraries (and even the ROM calls like file access, ...) so that, by changing a library, manually or even within an exec() function, we could run a program both under plain DoorsOs and Prosit, and [tie]. (Another great thing would be porting Prosit to [tie] when it gets enough stable...).

Another problem is the link: There is the standard cable, the IR-Link, the HF-Link... Wouldn't it be good if the progs could access any of these devices without any change ? The neat thing would be a networking protocol which should drive indifferently a 2 calcs cable, an IR net, or an I2C wired calc net. It is on my project list.

An important point is the language: since we are now able to use C or Pascal instead of ASM, it is possible that a library written in ASM will be used by a C program, or be replaced by a new version written in C. So it is important to always follow the C calling convention (even TI engineers do it !) for library calls at least.

Another step will be writing a C standard library, which would allow porting nice programs from the UNIX world... It is also on my project list ;-)

All these stuff would allow both DoorsOs/[tie] and Prosit to run a program.
An example would be a program which uses grayscales. Under DoorsOs it uses the standard gray4lib. Under Prosit it calls a special gray4lib which tells Prosit to allocate a virtual screen and disable the GUI untill a hotkey swaps to an other screen...

Modular programming is sometimes harder to get used to, but I think it is worth to. Something I use in my progs is to include a file named "config.h", common to all progs, in which a CONFIG.BAT writes the target (92/92+/89), the language (English, French,...), and I have a structure MAKE.BAT tree to help build the progs (Have a look at prosit_apps.zip, there is also a nice Othello game for Prosit in bonus).

Last thing: don't assume your programs will be compiled under DOS/Winblows! I had so many problems with DOS specific stuff under Linux... I still don't understand why so much people bother using DOS/Zin, as Linux is so great... :-((

My ultimate goal is to be able to surf the net on a TI (I mean not using any trick like Telnet83, but a real TCP/IP stack and stuff). What about you folks, do you think it is possible ?

I suggest the following to be discussed as a "Ti68k Open Programming guidelines" Request For Comment (RFC ;-))

  • Be as modular as possible
  • Try to comment the source code (I know it's hard to do)
  • Always use the C calling convention
  • Isolate I/O in libraries
  • Try to think of possible 'wrappers' on ti92 for something that doesn't exist.
  • Think about both 92 and 89 screen/keyboard


Well, what do you people think?
Talk amongst yourselves :-)

 


The comments below are written by ticalc.org visitors. Their views are not necessarily those of ticalc.org, and ticalc.org takes no responsibility for their content.


Re: Feature: 68K Programming Guidelines
Nathan Bollman Account Info

I vote no to combining shells, don't get me wrong and all it would be a nice feature, however more features means more space... In my own opinion Doors has the ideal # of features. How useful is multi tasking anyway on a screen that is 160 by 80<-? That's probably showing my ignorance but I didn't feel like looking it up. What would you want to do that you can't already do with nice small and STABLE single operating programs? I KNOW the ti-89 has plenty of memory however my motto for shells is, "keep it simple stupid" However standardizing libraries would be a worthwhile task. Not having 4 to 5 different libraries for grayscale. Seems better to just have grey.lib The programs would then choose between 7 or 4 shades of grey, and grey.lib would be compatable for all HW versions. Also as librarys become obsolete its time for programers to upgrade, when possible its good to make new Libs backwards compatable, but not to the point where it is wasting space for a primitive game. One last thing to get off my chest... Programers and picmakers don't make your programs with built in greyscale, the majority of us out here have learned to use librarys and it is a major waste of space. By the way anyone intrested in releasing an ASM Archive restore utility or know of one that already exists. Kind of hoping for a decent interface, but simple ands small...

     27 April 2000, 00:54 GMT


Re: Re: Feature: 68K Programming Guidelines
James!  Account Info

Upgrade to AMS 2.x, it has a built in archive restorer, w/ no clunky interface. AMS 2.03 is compatible with almost all important programs now, so you will still be able to run all your programs, and if you have a Hardware version 2 calc, you will get much more memory.

     30 April 2000, 04:38 GMT

Re: Feature: 68K Programming Guidelines
BeautifulGeorge  Account Info

i own a ti-92+ and it is really annoying that they are not as popular as 89's. most of the best programmers program for the 89. no one ports programs to 92+. i think libraries for screensize and keys are a good idea for everyone.

     27 April 2000, 03:47 GMT


Re: Re: Feature: 68K Programming Guidelines
Jared B  Account Info
(Web Page)

I believe you can run 89 assembly programs on the 92+ using the latest version of doors.

     28 April 2000, 02:47 GMT

Re: Feature: 68K Programming Guidelines
mmu_man  Account Info
(Web Page)

Wow, I had forgotten I posted this article (it was in January)...

Well, things changed a little bit since I wrote this...
I'll try to reply to as many comments posted here.

1. 'do you think anybody will REALLY do any of it?'
I know they wont. It's good for health to dream. ;-)))
BTW, before enforcing anyone to follow any rule, we have to discuss them... Then, they aren't rules, just 'guidelines', RECOMMENDATIONS.
Even TI themselves cannot make rules.

2. C calling conventions and languages
I know C calling is heavier than register passing, but the TIGCC for windows is a BROKEN GCC, which doesn't features all the options GCC had. With the real gcc you could declare:

#define my_func my_lib__0000
int my_func(int register __asm__("d0"));
(I really tested this with a real gcc configured for Fargo more than a year ago, before TIGCC exist)
People at ti aren't thinking sometime... no interrupt pins (well, I the link can be used for that...but...). And they use some registers without saving them...
the problem is GCC cannot optimise as well as it could because of that.

Using C convention also allows use of other languages that understands that (like PASCAL...), so it is no way limiting.
Using C convention help using libraries... I think the problems now is the libraries packet with the shells (DoorsOs...) use register passing, and aren't usable with C, which has made that C programs use worst things like direct access...
It's a pitty.

3. Standard library
I think that it could be very usefull and would help porting unix programs. I'll try to write such a library (with calls like fopen()...)

It would also help porting plain shell programs to Prosit, as I'll use wrappers in include files, like:
/*foo.h*/
#ifdef PROSIT
#include <prosit/stdlibc/foo.h>
#else
#include <stdlibc/foo.h>
#endif

4. Prosit and multitasking
Since I'm working on Prosit now, and since we have TIGCC for Linux (this time it
is a REAL GCC), I'll try to implement POSIX system calls (sorry, all but the fork() for now... but vfork() will be available).

5. TCP/IP - Networking
TCP/IP would really be neat, I'd like a small TCP/IP stack, with drivers for either SLIP with the link, an I2C network, IR/HF link, and other, so the program won't have to bother wih the link used. (abstraction layer). I'll try to implement MBUS also. Maybe kinda MBusPortmapper to TCP ports.

What about WAP (Wireless Application Protocol) ?

BTW, do I speak such a bad english ?

Francois Revol,
alias mmu_man.

     27 April 2000, 09:52 GMT

Re: Re: Feature: 68K Programming Guidelines
groyab  Account Info
(Web Page)

Two or three days ago, I woke up and decided to port Caml (a ML language) on my brave new Ti92+. So I got a book at the library : 'The Standard C library', by Paul Plaugger (he presided the C ANSI commission years ago, so he's quite good at C programming :)
I began to copy stdio.h, the most interesting one, and it's on the verge to be finished...

     27 April 2000, 18:46 GMT


Re: Re: Feature: 68K Programming Guidelines
Zeljko Juric  Account Info
(Web Page)

For everybody who wants to write stdio.h and stdlib.h, I want to say: DON'T DO IT, because I already done nearly all of them. They will be included in tigcclib 2.0 which will be released in the middle of May. tigcclib 2.0 will be a revolutionar: nearly 400 new functions in comparing than tigcclib 1.5 (documented, of course). Including standard libraries, much more symbolic mathematic, preety printing, event driven programming, text editor, archive memory access, etc. In fact the library is nearly finished, but the documentation... I want to explain complicated things (like events) in detail, but something is quite hard to explain, especially for me (because my english is quite limited, so I often must use awkward sentences to express my minds).

     28 April 2000, 10:10 GMT

Re: Feature: 68K Programming Guidelines
Reno  Account Info

Is it possible to just directly read from the flash memory, instead of copying to ram or unarchiving and rearchiving? The 83+ seems to have this...

     27 April 2000, 23:30 GMT


Re: Re: Feature: 68K Programming Guidelines
Jeff Flanigan  Account Info

Of course, the TI rom runs from flash mem. Programs are copied so that they can do program write back during execution.

     28 April 2000, 00:32 GMT

Throw all that 68K knowledge off the board
Roberto  Account Info
(Web Page)

I suggested this on acz.org months ago, and they felt insulted:

Shouldn't it be easier, instead of making about games, browsers and word processors for calculators, to port math software to a Gameboy, PocketPC or Palm? I would like very much to have an open source CAS than the inflexibility of TI's Derive. An open source CAS may compete with Matlab :) We would even have full color 3d graphs!

The Compaq 1530 is $20 more expensive than the TI89, but is 7X the MHz, has a RISC CPU, 4 times the pixels and 16 levels of gray. There is a free HP48GX emulator, a free Gameboy emulator and an awesome Photo-editing software for WinCE 2.0. Doesn't it make you want to try it?

Reference: go to www.wincecity.com

     28 April 2000, 01:29 GMT

Re: Throw all that 68K knowledge off the board
Roberto  Account Info
(Web Page)

It is me again,

Of course, I speak from the college student perpective: we are allowed to take computers to class, and we know to separate class time and play time :)

You might also be saying: "PDAs don't have no keys!" I would then call for a little creativity from the adopters of this project. I am not saying that hand-writing "tanh" in Jot calligraphy would be easy, but that there must be a better way than punching buttons like we do since 40 years ago ;)

     28 April 2000, 01:44 GMT


Re: Re: Throw all that 68K knowledge off the board
Roberto  Account Info
(Web Page)

Platform freedom!

     28 April 2000, 01:51 GMT

Re: Throw all that 68K knowledge off the board
Samir Ribic  Account Info
(Web Page)

MuMath, the very early version of Derive has source in special language MuSimp. Somtimes it is available on Internet.

     28 April 2000, 14:43 GMT


Re: Throw all that 68K knowledge off the board
David Phillips  Account Info
(Web Page)

Insulted? Not sure where you got that. Basically, the reason that the Game Boy is not feasible for use as a calculator is the lack of keys. The TI-89 is hard enough to use (I really love the 86) with it's limited keypad. You'd need some sort of mouse driven interface, but it would be much, much harder to use than a traditional calculator.

     29 April 2000, 03:16 GMT

Re: Feature: 68K Programming Guidelines
Dark_Ninja

Just wondering what compiler do I use to compile the C source code for the TI-89? Also, does anybody know of any tutorials for C for the TI-89, or is it similar to C for a regular computer?

Also, I have messed around with connecting to the net on my TI-89. I have managed to obtain a connection, but it was pretty crappy. I think if someone can design a program, similar to a UNIX shell, then the TI world will have themselves a calc that can surf the net. Especially if someone can design a modem that can be hooked up to through the TI Graph Link. Kind of like Palm Pilots do. Just an idea.

     28 April 2000, 04:16 GMT


Re: Re: Feature: 68K Programming Guidelines
Sebastian Reichelt  Account Info

The only C compiler I know of is TI-GCC in the Windows Assembly Utilities. There you will also find a great library and an IDE (which I wrote - not the library, but the IDE). Programming for it is a lot like regular C, although I don't know C very well. (I've had a C++ computer science class for a year, that's it; but I can program in it without problems.)

     28 April 2000, 21:01 GMT


Re: Re: Re: Feature: 68K Programming Guidelines
Reno  Account Info

that IDE is pretty nice

     28 April 2000, 22:07 GMT

Re: Feature: 68K Programming Guidelines
Uberjedi
(Web Page)

I was wondering if anyone has considered using Perl for the 89 or any calc. It's an incredibly flexible programming language that's based off of C, which (IMO) is better than C (though it's not as efficient). It probably wouldn't have much use for games, but would work good for any TCP/IP job.

I think a browser for any calc is infeasible cause of the screen; an email client would probably work the best for it. Why the heck would you want/need an FTP client on the calc? you couldn't upload or download anything of considerable size.

     29 April 2000, 07:06 GMT


Re: Re: Feature: 68K Programming Guidelines
Samir Ribic  Account Info
(Web Page)

Well, because TI89 can accept files up to 64 K, you can upload/download files of such size. If the file is bigger than it, it is anyway not dedicated for calculator, same as Linux users does not download Machintosh files.

For web browsing: TI92+ allows 60-80 characters per line (proportional font). On TI-89 we can see 40-60 characters. This seems enough. However, limited RAM makes that we can not cache web page in memory. While on FTP you know size of the file you want to download, on WWW you do not know it in advance. So, the page must be shown on fly and if you missed something to read, you must reconnect. Well this is much worse browser than Lynx, not mention Opera, MSIE, or Netscape, but pocket calculators are machines with
500 times less RAM than monsters that use such browsers.

I agree that mail is most useful service for pocket calc. And, the most of other services are available via mail. You can ask newsgroups via mail, download FTP or HTTP as mailed messages etc.

     29 April 2000, 09:29 GMT

Re: Feature: 68K Programming Guidelines
mathphreak Account Info

The TI's port operates at 9600 baud. It would be one slow internet.

     29 April 2000, 17:50 GMT

Re: Feature: 68K Programming Guidelines
Gohan Account Info
(Web Page)

I know this is a little off the subject but, I have a TI-89 and I was wondering, where can I find out what hardware version I have, HW1 or HW2? I just don't have any clue which type I have :(

     29 April 2000, 20:02 GMT


Re: Re: Feature: 68K Programming Guidelines
Reno  Account Info

At home screen:

F1, alpha + a

     29 April 2000, 22:17 GMT

1  2  3  4  

You can change the number of comments per page in Account Preferences.

  Copyright © 1996-2012, the ticalc.org project. All rights reserved. | Contact Us | Disclaimer