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
CrazyBillyO  Account Info
(Web Page)

That sounds all fine and dandy but do you think anybody will REALLY do any of it? Some developers probably don't even care about cross-shell or calc compatibility. :-( Some people who have made asm programs may not have enough knowledge to even do the aforementioned suggestions.

Don't get me wrong, everybody should do them, but it doesn't look feasible. Just more work for the programmer.

What are the C calling conventions again? They make us do JAVA ad nauseam, those despots... no time for much else. :-(

fc maybe? We'll just have to see...

     26 April 2000, 01:59 GMT

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

Not sure about return values, but if I remember correctly the arguments are pushed onto the stack in reverse order (ie the last thing pushed is the last argument). And also, the caller of the subroutine is expected to clean up the stack afterwards. Something like that :-)

     26 April 2000, 02:20 GMT

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

Sounds about right, yes.

In the TI ROM you can freely modify d0-d2 and a0-a2 (dunno if this is standard for 68k C), and your return values are in d0 (if it's a value that fits in 32 bits) or in a0 (if you return a pointer). If you return something larger than 32 bits then I think it ends up on the callers stack frame, although I'm not sure.

     26 April 2000, 02:29 GMT

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

There is a section in the TIGCCLIB tutorial talking about the C calling convention. It's in the Windows Assembly Utilities.

     26 April 2000, 05:55 GMT

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

First, thanks for the kind comments on my little (currently on hold) project. :)

Insofar this all is possible I think it's a great idea. The main problems arise from the lack of documentation of ROM calls on ye olde TI-92 (where ROM linking has to be done by the linker since there is no ROM table on the calc), and the screen size difference between the 89 and 92 models. For the latter my solution has always been to separate the two at compile time.

Isolating hardware access in libraries: a good idea in theory, but many games are as good as they are because they squeeze every little bit out of the hardware by controlling it directly. Remember the old DOS games? Many of them where truly excellent, but hard to get to work on many configurations. Windows kinda solved that problem, but look at what computer power modern games require... (no computer flames please).
Anyways, with relocation you can solve many of those problems, provided that people don't use fixed addresses in their programs but let the kernel insert the correct ones at runtime.

The link: No comments, never programmed anything for it.

C calling convention: it's nice and easy, but like with the libraries above it sacrifices some speed. If you're calling the same routine 10000 times you want the call to go as fast as possible (actually, you should make the routine inline, but that's not the point).

C standard library: not that useful as long as the TIOS dominated the calc. Now, with a replacement OS we could have some fun and actually use the calc for other things than math and games (I dream of the day when I can hook up a little touchpad to my 92+ and take notes in class), but I don't see that happening anytime soon.

Comment your code: No arguments here. I have many an old program I can't for the life of me figure out why I wrote the code like I did.

TCP/IP stack: certainly possible - people have done it with far less CPU speed/memory space. A little archive browsing at /. should give you a link or two. ;o)

One major suggestion I have for people who want their source to be maintainable: source documentation on a higher level. Don't just comment your little routines and their calling parameters - write a little something about the program/set of routines as a whole, too. A text version of the old flowchart, so to speak.

This may seem a little incoherent, but I'm writing it at 2 in the morning so I just don't care =)

     26 April 2000, 02:18 GMT

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

Adding a few comments of my own:

hardware access only in libs: the 89 isn't really suited for this kind of thing or the multitasking of normal progs that you're looking for. Obviously, many games are not well suited for this on the 89. Similarly, many windows games need that sole hardware access themselves, hence directx programs don't really multitask - they're suspended when you alt-tab out of them.

C calling convention: agreed, although it would have been nice if this was started a year ago.

C stdlib: as niklas said, much of it isn't very useful under tios. Just use TI's APIs rather than typical C lib functions.

comments: depends on the intended purpose of the code. If it's code I'm writing for myself and don't expect someone else to use - especially if it's some very well optimized ASM routines that would require other large portions of code to be changed in conjunction.

maintainable source: there's not much more you can do other than comments and a lot of explanations, then hope that others are intelligent enough and think similarly enough to fully understand and continue the code. And since most calc programmers aren't formally educated and don't have much such experience, it's not likely that someone on your level will be the one who wants to continue your code.

     26 April 2000, 02:58 GMT

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

I don't remember where I saw it, but there was the "world's smallest TCP/IP stack". It was like 256 bytes of ROM code with 256 bytes of data, or quite close. It was a special chip, not 68k, so I'm not saying the size for 68k could be under 256 bytes, but it is certainly possible to have a working TCP/IP without very much code.

     26 April 2000, 13:19 GMT

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

It was a web server based around a PIC microcontroller and a Seiko iReady hardware TCP/IP stack.

     26 April 2000, 18:17 GMT

Re: Feature: 68K Programming Guidelines
gigowiz  Account Info

These are all great ideas, but they will take forever to implement. I wonder how much memory a TI-83+ Internet Explorer would use?

     26 April 2000, 02:29 GMT

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

I have about 10 instances of IE open at times on my desktop. I wonder how much memory THEY use :P


     26 April 2000, 03:20 GMT

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


hey anyone download my STARWARS mod????

     26 April 2000, 04:06 GMT

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

i think this is a good idea as well....although i cant program in 68k at all...just BASIC hehe....having some sort of standard is desirable, but isnt it a bit late? if everyone could work together and pull this off it'd be pretty amazing and we'd really be showing TI what we can do.

oh yeah, i downloaded your star wars mod =) i'm not talking about the earlier beta you sent me, but the new one you put up. good job =)

     26 April 2000, 06:23 GMT

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

I have at the most 7 IE windows open at once. That's not including Outlook Express, and the millions backgound programs I have running. Okay, maybe not millions... =)

These are great ideas. One problem. Can you get evryone to stick to one standard? Or even get people to work together? I myself would love to make a single shell that would run every program on every AMS and on every Hardware version. Oh well... I guess my TI-89 can wait.

     26 April 2000, 04:54 GMT

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

NETSCAPE ALL THE WAY! What's wrong with you people using IE? Get a clue! Netscape is the way to go, you're just so wrapped up in your little IE browsing that you probably don't even know what Netscape is! Well wake up and smell the beans, because it's THE WAY to browse the net. No questions asked.

Of course, this is coming from the same guy who actually owns an iMac, but still...

-Fil and his $0.02

     26 April 2000, 06:19 GMT

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

Are you talking?


     26 April 2000, 08:36 GMT

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


-Frothing Fil

     26 April 2000, 17:13 GMT

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

Why hasn't anyone mentioned Opera? It's quite efficient... Seriously give it a try....

*Warning*: It's not free.... unless you pirate... ;)

And on another note, I am still on a personal venture to rid my system of anything Microsoft related... Especially MS Word and Excel... I LOVE WordPerfect... Click the web link above... not the Opera one...

     28 April 2000, 06:56 GMT

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

Why would you want to get rid of microsoft programs when you are running opera on windoze 95!/98:( /nt/2000
I have linux but still use microsoft programs even if little stuff on linux like my printer and other stuff worked I would still have to use microsoft programs to do almost anything!!! I have to use microsoft to send game to calc. Your probably using widoze right now. So just get over it they are all good programs and its not like the people making them aren't good programers it's just they are paid to make their programs look mickey mousey.

     30 April 2000, 18:42 GMT

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

I used to use Netscape, from 1.1 to 3.0, but you must admit: IE is just better. Maybe MS used some pretty unfair tricks, but that doesn't stop me from using their software. If only they'd release IE for Linux...

And besides, now that AOL has bought Netscape, you really can't expect anything good to happen to it, can you?

     26 April 2000, 15:53 GMT

Re: Re: Re: Re: Re: Feature: 68K Programming Guidelines
Kenneth Arnold Account Info


Do you have any idea how much external software IE requires? They'd have to port COM,DOM,DDE,ActiveX,etc. (I'm sure I duplicated a few there).

And then it wouldn't work very well because it relies on hacks in the kernel and undocumented APIs to squeeze in just a little more speed. No mucking with the Linux kernel, thank you very much. They might, but I wouldn't compile it (it'd have to be open-source GPL).

Take a look at the Sun port.


     26 April 2000, 22:28 GMT

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

I stay away from anything associated with AOL......well, except AIM. sigh:P

     26 April 2000, 22:43 GMT

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

From a web development standpoint, Netscape is on the bottom of the pile (or close to it). NS4 and below didn't have much support for even the standardized commands. I can't speak for NS6 because I've only tried it under linux and hated it and didn't use it long enough to see if it supports CSS yet (which is fully implemented in IE)...

-Erik Davidson

     26 April 2000, 21:06 GMT

Re: Re: Re: Re: Re: Feature: 68K Programming Guidelines
Kenneth Arnold Account Info

eat socks. this message posted from Mozilla M15 (seamonkey). yeah it has bugs, but it does indeed support CSS (see the M15 release notes) and bunches of other stuff, and is already threatening IE in standards compliance. it crashes every once in a while now (especially while I'm doing something especially important), but (a) look how far it's come, and it's still in pre-release (a lot of Microsoft is this buggy and sells for about $100), and (b) since I'm running it under Linux, it doesn't take the whole system down with it. Ever. Now a different story with IE, which is, contrary to what Microsoft likes to say, way too integrated with the shell to be called something separate (no? then why are most of *Windows* Update's critical updates bugfixes for *Internet Explorer*?). Mozilla might modify a few registry entries and leave them there, but so do a lot of uninstallers for Windows. enough?


Maybe Netscape's browsers aren't the greatest for Web development, but for regular development? Well you can't beat having the source code (but it is huge and could take up to 1 GB of space to build, so it is said). I think you can still rip the hearts (Gecko) right out of the source and use it in your own apps (as long as this is okay with Netscape's Public License).


     26 April 2000, 22:17 GMT

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

I didn't hate NS6 because of bugs or crashes, but I just didn't like the UI... It seems too childish.

-Erik Davidson

     27 April 2000, 03:33 GMT

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

If you don't like the UI, get a skinand change it whatever you like, or create your own one (there is tools for it)

for more info www.mozillazine.org and click on chromezone ...


     27 April 2000, 03:57 GMT

Re: Re: Re: Re: Re: Re: Feature: 68K Programming Guidelines
Eric Greening  Account Info

Yeah, Mozilla all the way! I can't wait until the final release of NS6. I mean, not being able to copy in it just ruins the 'internet experience.' :-P Well, maybe not that bad but, being able to copy would be nice. I haven't had NS6 crash once. Oh, TICalc, your page isn't right in NS6. There aren't any spaces between the news items. NS6 would be nicer if it didn't take so long to start up and etc. I'm sure, if I where to try to have both, NS6 and DreamWeaver3 open, it would kill my computer (I wont even bring up 3D Studio MAX). :-)

I don't know if I'm just IE impaired but, with IE 5.01 I am using it but, then it says I've performed an illegal operation and when I try to close it, it just opens another one. I even close all explorers (except the shell, of course) but, it still remains. It requires a reboot to get rid of the evil box.

Okay, time to talk about the news item. I agree with it 100%. If just the programmers would all come together and do it. I know I would. :-)

Well, that's probably all I have to say. I can't think of anything anyways...

Glenn Murphy (a.k.a. Eric Greening)..

     27 April 2000, 05:04 GMT

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

My 2 cents:
(from the poverty stricken land of Socket 5 Pentium 90's)

I think Netscape was better until M$ released IE 5.

Now they are both tied. I mean, Netscape always starts downloads and has a status indicator and its associated mail program does NOT crash my computer. But it sucks at accually browsing the web.

IE 5 loads websites about 2 times faster than Netscape, however, file downloads are 2 times slower, they dont always start and it doesn't always say how big the file is and how much time is left.

     27 April 2000, 01:21 GMT

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

IE loads itself (and websites) lot faster cause the whole windows GUI is based on IE, so it is permanently running (which sux) and the websites load faster cause it can drain system resources up to 100% since it has direct access to the system.
Where as in netscape, it have to use system resources which are available and same with loading.
Somebody once calculated if IE was not directly included in winblows, it would load prrox twice as longer as netscape .. phat ..

(i just can't wait until US Gov will spearate M$ and IE will have to be taken out of the windows .. A) the windows will be smaller by 50 - 80 megs B) there will be much more resources for other apps to run C) it will be more fair to others ...

that's it for now ..

     27 April 2000, 03:56 GMT

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

Personally I use both. There are some great features in both of them. Netscape has alot of javascript help built in to it. But for main browsing I use IE5.0. It loads the quickest and is easy because it's built into Win98.

     27 April 2000, 07:55 GMT

Re: Re: Re: Re: Feature: 68K Programming Guidelines
Chris Fazio  Account Info

Netscape's downloads are faster than IE, and certainly a helluva lot better that AOL, there's one problem: alot of the new HTML commands don't work on Netscape. Sure, when there are newer versions of Netscape and HTML 4 becomes standard, it won't be such a problem. But it is kinda annoying when my friends aren't enjoying my websites as much as me

     27 April 2000, 20:42 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