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
(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: Feature: 68K Programming Guidelines
|
Niklas Brunlid
(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: Feature: 68K Programming Guidelines
|
gigowiz
|
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: Re: Re: Re: Feature: 68K Programming Guidelines
|
Kenneth Arnold
|
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?
okay.
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).
Kenenth
|
|
26 April 2000, 22:17 GMT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Re: Re: Re: Re: Re: Feature: 68K Programming Guidelines
|
Eric Greening
|
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
|
|
1 2 3 4
You can change the number of comments per page in Account Preferences.
|