 |
 |
Programmers Question...
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2001
Location: SouthBank, Victoria, Australia
Status:
Offline
|
|
I recently bought a MP2000, and even though I haven't started programming for it as of yet I WOULD REALLY LIKE TO!
Anyways, I know of programming tools out there, namely NTK which I think is C/C++ environment. There is also MPW with headers, and NewtonScript...
I wouldn't mind, say porting a old time favourite game... Wolfenstein 3D. if it can be done... no doubt it can.
So I'm looking for and Assembly environment that I could program StrongArm code. But it has to run on Macintosh. IS there one out there?
cheers 
|
|
"We are what we repeatedly do. Excellence then, is not an act, but a habit." Aristotle
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Dec 2000
Location: Paris, France
Status:
Offline
|
|
NTK is the NewtonScript programming environment. To do C/C++ or assembly language, you'll need MPW and the Newton C++ Tools. You'll find all this ready in the NewtonDev package.
Please note that as the Newton's interface has been written in NewtonScript, you cannot write a 100% native application. For example, ATA Support is made of 15% of NewtonScript code.
Paul
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2001
Location: SouthBank, Victoria, Australia
Status:
Offline
|
|
Originally posted by Paul Guyot:
<STRONG>...
Please note that as the Newton's interface has been written in NewtonScript, you cannot write a 100% native application. For example, ATA Support is made of 15% of NewtonScript code...</STRONG>
Can you bypass Interface issues... say like writing to video memory directly, like some games do on Macintosh or PC? If so I don't see a real reason why NewtonScript should be used... basic ASM or C/C++/ASM would do what I require.
I don't really what to make it with NewtonScript. Basically if I were to somehow port Wolfenstein 3D over... I would make it that you NEED a Newton compatible keyboard... Also key capture would be done via ASM...
Drawing to screen via C/C++ (mainly C as I don't really like C++) and ASM.
Writing to SCREEN/GAME LOGIC would be something along these lines:
1. save initial screen state
2. we capure screen state
3. do game logic
/* when quit */
4. restore initial screen state
Any faults in this process? As I just captured just a small portion of game design from an old Dos game book of mine "Game Programming Gurus. by Andrea LaMont"
cheers
|
|
"We are what we repeatedly do. Excellence then, is not an act, but a habit." Aristotle
|
| |
|
|
|
 |
|
 |
|
<Daed>
|
|
Hello My7200,
I'm a relative novice at NewtonScript programming (and I'm not a programmer by trade), so take my suggestions below all with a huge grain of salt. Paul Guyot is a much more reliable authority. Even so, I'll try to point you in some potentially useful directions.
First, my understanding is that the Newton C++ tools are rather limited (I've never used 'em, but I've tried to keep a close eye on other programmer's opinions). I believe they were released just as the Newton development team was being disbanded, in order to give other Newton developers some access to networking and communications stuff that NewtonScript didn't have access to. Paul, please correct me if you know better!
Second, the Newton doesn't have video memory (I'm hoping you already know this and that your reference was just a "for instance" of bypassing limitations). In fact, anything done with 3D graphics runs extremely slow on the Newton (even the faster StrongARM-based MP 2x00s). There have only been a couple instances that I've seen of people doing 3D stuff on a Newton. Probably the one of most potential interest to you is NewtsPrism's port of OpenGL to the Newton, called NewtonGL. I've never seen anybody use it in other applications, unfortunately, and it's not a complete port, but if you want to take a look, the URL is:
http://members.aol.com/NewtsPrism/Ne.../NewtonGL.html
I wish you luck! You do have your work cut out for you, especially in the speed area.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2001
Location: SouthBank, Victoria, Australia
Status:
Offline
|
|
Yep... seen the site before, but I'm not contemplaiting writing a 3D engine for Newton.
Wolfenstein 3d is a 2D world, that looks 3d. More correctly its a 2.5D world. Doesn't require a lot of Floating Point math.
Probably the Newon doesn't have FPU seeing that it is a Integer based CPU, but these limitations can be nicly handled in integer maths... I'm sure if you were to read a DOS/Mac game programming books they show you how to do most caluculations in integer.
Ref:
- Game Programming Gurus (DOS: author Andrea LaMont)
- Mac Game Programing Gurus (Mac: author forgot (sold book))
Anyways: I'm pretty sure you can bypass the NewtonsScript to write to screen, after all Apple bought the StrongArm chip from ARM, and I'm sure if you basically did StrongARM code you could somehow write to SCREEN directly... this is what I need (reference to getting this information or a short snippet of code that does what I require)...
Seeing that there are still people out there that still code for the Newton... I find it hard that no one has responed more anthusiastically...
Newton programmers out there... this question goes out to you!
cheers
|
|
"We are what we repeatedly do. Excellence then, is not an act, but a habit." Aristotle
|
| |
|
|
|
 |
|
 |
|
<Daed>
|
|
Yeah, I understand about the 2.5D nature of Wolfenstein (although I'm more of a Pathways into Darkness/Marathon fanatic myself). Nevertheless, it takes a lot more processing power (and memory) to do this than, say, simple sprite-based games.
The truth is that the Newton never had much of a selection of decent games, unfortunately, so you're probably intending to break some new ground here (and that's why nobody is rushing to answer you!). I really do hope you get some answers, because I'm dying to get some more decent games for the platform. I'm making some half-hearted attempts myself at creating some Newton games while teaching myself how to program the Newt, but they are more card-like games. But, hey, it's a place to start!
If you haven't tried asking the NewtonTalk group, this is probably the best place to ask technical questions:
http://www.newtontalk.net/
Another possible source of info is from the comp.sys.newton.programmer Usenet newsgroup. At the very least you might be able to go to groups.google.com and seach the archives of that newsgroup to see if it has ever been discussed before.
Best of luck! Hope to see more of you in the future!
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Dec 2000
Location: Paris, France
Status:
Offline
|
|
Any faults in this process?
In my opinion of a Newton programmer, you're doing two mistakes:
A/ You're thinking at the NewtonOS like DOS or some primitive operating system.
NewtonOS does preemptive multithreading. There are a couple of tasks which draw on the screen, the inker, the busy box, the card server "Newton still needs the card you inserted" and the NewtonScript task.
You can deactivate the inker and the busy box, hope that the user won't remove any card, but you can't get rid of the NewtonScript task (well, you can, but if you do, you will have to reboot the unit when the game will be over).
B/ You're forgetting that the Newton has a uniform human interface. It's not a video game platform (and even video game platforms do have a uniform human interface, such as when you press start it pauses the game, unlike DOS).
I won't say that porting Wolfenstein 3D to the Newton is impossible. I really think it is possible, just like porting Linux or any unix to the Newton platform. The MP2x00s are fast enough, you don't need much ram to run W3D in 16 grays and if required it would only run on a MP2100. But you should try to understand the platform first before trying to code on it as described in books which were not written for the Newton.
If I wrote a game such as W3D, I would maintain a NewtonScript interface for the game save/restore and start button. Then, once the game started, I would use QuickDraw to draw on the screen (instead of using NewtonScript). You might even want to draw directly on the screen, but have fun to find out how to do this (drawing on the screen with quickdraw isn't neither documented, but several programs do it).
First, my understanding is that the Newton C++ tools are rather limited (I've never used 'em, but I've tried to keep a close eye on other programmer's opinions). I believe they were released just as the Newton development team was being disbanded, in order to give other Newton developers some access to networking and communications stuff that NewtonScript didn't have access to.
Well, this is half true. First, the Newton folks wanted to answer to the need of developers to have tools to accelerate primitives (typical use: a chess game). So they took the NewtonOS sources and released a very small portion of defintions out of it (384 functions) as the Newton C++ Toolbox with scripts they used and some they adapted/wrote for that. I think it was based on tools they used for driver development. Then, they released a suite of driver development kits, which was also based on NewtonOS sources but gave access to a much larger part of the public APIs. These kits are the only way to write drivers. The definitions in these kits allows you to write communication functions (such as an HTTP server, but without the interface which should be written in NewtonScript) out of it, but it's not documented - when NewtonOS was axed, the official way was to use NewtonScript (which sucks for comms).
Both C++ suites are complementary, and this is frustrating because you aren't able to access to most APIs of the Newton from regular applications (you are able to do it from drivers only). The NewtonDev package includes some hack to fix this problem.
Anyways: I'm pretty sure you can bypass the NewtonsScript to write to screen, after all Apple bought the StrongArm chip from ARM, and I'm sure if you basically did StrongARM code you could somehow write to SCREEN directly... this is what I need (reference to getting this information or a short snippet of code that does what I require)...
Good luck. Also double check that it will at least work on every 2.1 platform.
Seeing that there are still people out there that still code for the Newton... I find it hard that no one has responed more anthusiastically...
Because you do not look like an experienced coder for the Newton. We've seen dozens of utopic projects around, I remember someone saying that he would code a PalmOS emulator in NewtonScript.... At least, you seem a little bit more realist. Don't worry, enthusiasm will come with the technology preview.
Paul
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2001
Location: SouthBank, Victoria, Australia
Status:
Offline
|
|
I'm very disappointed...
This all discussion has gone on the wrong way...
First of all
- I couldn't care less if the Newton is Preemptive or Co-operative (Remember MacOS). The game logic was also taken out of the Mac Programming Gurus Book, and I'm sorry if I hurt anyone’s feelings when I said I got it out of the DOS reference. I initially bought a PC and even though I didn't bring out Quake on either platform, I did get some interesting details on how to do things, both on PC/Mac. I OWN A 8100/9600 and the name my7200 comes from the fact that I bought my mother a 7200!
Anyways, seeing that 'Mac Programming Gurus Book' was a MAC book, and written within it, you BASICALLY were told to break what Apple said about following GUI guidelines... I think it would be a fair assumption that the same goes for any platform PC/Mac/UNIX/Newton etc!
Games are not applications like word processing/spreadsheets... TO MANY PEOPLE FORGET THIS!
And there is one thing I hate is not getting a definite response.
Is there a way to write to SCREEN directly?
What IDE/compilers do I need? Already received.
And as far as completing the Wolfenstein 3d game, if I don't manage to do it, well its because other things came up. But until that happens... I've got the original source, and I really am going to try to port the bloody thing (as a hobby, anyways)...
And another thing... learning to programming on platform for the first time is a learning experience. And the remark 'Learn the Newton before you try to program' is a bit of a blatant remark! If I knew the Newton inside and out, I wouldn't be asking these questions in the first place.
The first time I tried my coding practices on a Mac, I really didn't know how to program for the Mac, even though I did 4 years of CompSci learning f*cking 15 or so API/languages. Does that mean I'm incapable of trying to code for Newton?
Cheers
|
|
"We are what we repeatedly do. Excellence then, is not an act, but a habit." Aristotle
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Dec 2000
Location: Paris, France
Status:
Offline
|
|
I couldn't care less if the Newton is Preemptive or Co-operative (Remember MacOS). The game logic was also taken out of the Mac Programming Gurus Book, and I'm sorry if I hurt anyone’s feelings when I said I got it out of the DOS reference.
I wasn't hurt by the DOS reference, on the contrary. What I meant is that in spite of the strange management of the memory, DOS is a much easier platform to code games than MacOS which, itself, is much easier than Newton for video games. The main reason is that DOS is monotasking, MacOS mostly does cooperative multitasking and NewtonOS does preemptive multitasking. On MacOS, the trick is to not call GetNextEvent or WaitNextEvent and to read the keyboard/mouse directly, so you indeed bypass the scheduler. On NewtonOS, it's not that easy. You have to do something with the NewtonScript task, maybe suspend it, but then, you'll have to get input from the player. This is doable, but I don't know any programming doing it. Running your program in the NewtonScript task itself as every NewtonOS application does may not be satisfying because you probably want a higher priority.
Games are not applications like word processing/spreadsheets... TO MANY PEOPLE FORGET THIS!
NewtonOS is not an OS like MacOS or DOS, and applications on NewtonOS are not like applications on MacOS or DOS. I won't shout to say that you seem to forget this.
And there is one thing I hate is not getting a definite response.
Is there a way to write to SCREEN directly?
You got a definite response, but not the one you wanted to hear. Of course, there is a way to write to the screen directly. If required, change the daughter board or create your own system update to do that (creating a system update is AFAIK, the only way to enter the supervisor mode). You can do whatever you want. But you'll have to dig it up, as there is no documented way to write to the screen directly. Alternatively, you can write on the screen using QuickDraw. It's easier and it will probably be more compatible, although you're on your own as well for the documentation.
What IDE/compilers do I need? Already received.
I also gave you a definitive answer to this question as well in my first post. Try the NewtonDev package. It will be updated to 1.1 very soon.
And another thing... learning to programming on platform for the first time is a learning experience.
Indeed. And like every active developer around, I am and I will be very pleased to help you.
And the remark 'Learn the Newton before you try to program' is a bit of a blatant remark! If I knew the Newton inside and out, I wouldn't be asking these questions in the first place.
It's not what I wrote. I wrote: But you should try to understand the platform first before trying to code on it as described in books which were not written for the Newton.. My general idea was: don't try to port ways of programming. Just port the game.
The first time I tried my coding practices on a Mac, I really didn't know how to program for the Mac, even though I did 4 years of CompSci learning f*cking 15 or so API/languages. Does that mean I'm incapable of trying to code for Newton?
Of course it doesn't. I never doubted that you were capable of trying to code and even of coding for the Newton. I code a lot for the Newton and I haven't done a single year of CompSci as you say.
Paul
|
|
|
| |
|
|
|
 |
|
 |
|
<Daed>
|
|
Paul--
Thanks for the clarifications regarding the Newton C++ tools. I knew that the these tools could be used for rather focused applications (like device drivers, as you point out)--but, I wasn't sure if the tools were complete or extensive enough to, say, code a full Wolfenstein game! Actually, I'm still not sure, but as you say, the C++ tools can't access the full suite of NewtonScript APIs, so at best I'd assume writing a large game entirely in C++ for the Newton would be a heck of a lot of work!
my7200--
I think your frustration is a result of what I tried to (somewhat feebly) point out in my earlier post. Nobody AFAIK has done what you want to do on the Newton, so there's not many direct answers that you're likely to find. Doesn't mean it's impossible, just means you're going to have to do a lot of the legwork! Documentation on how to implement graphics on the Newton is almost nonexistant.
Also, go easy on Paul! He is one of only a couple handfuls of people still actively writing decent (useful) software for the platform.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2001
Location: SouthBank, Victoria, Australia
Status:
Offline
|
|
Sorry guys if I got a bit hot under the collar, but I did feel somewhat insulted. I did initially feel that both of you were making fun of my DOS background... but anyways, the whole of the matter started because I wanted to port W3D on Newton.
Now, I know that I require NewtonScript if I were to do the Application as a Newton Package. I think I have this right? Applications on Newton are considered packages?
But as for drawing to screen directly, as a programmer I find it hard to beleive that the only way to do it is through NewtonScript. Surely the Apple docs are not the only ones detailing on how to write code for Newton. I'm sure ARM have something (discussed below).
The link which Paul gave me was indeed useful. Haven't had much time playing with MPW, mainly read the PDFs docs which I also downloaded from Apple.
Now I think I'm correct in saying that to run the code you need to transfer the code from Mac to Newton, and that MPW has no emulation mode for running code on Mac? If this is correct, its a shame. I recently received an developer suite evaluation pack from ARM with IDE/Debugger/Simulation but of course it only runs on PC, another reason which initially I should have pointed out... I required a similar coding environment with the same features but to run on Mac... I've used Metrowerks, the IDE that comes on the CD, before on Mac that was... back when it was Version 8 and Metrowerks had the 3Free Full updates instead of the now 2Free Full update... but thats another topic...
Anyways within this evaluation CD... wait for it... the languages supported are C/C++/ARM assembly for ALL ARM cores... thats including StrongArm.
Now I initailly went to ARM site when I got the Newton... but did not get the evaluation CD until today 10/6 EST. Read through the info on the site and decided it would be neat if I could port the W3d app over. Now, I've been monitering the Newton scene before I even got the thing, but came nothing across to what I want to do. The very reason I came to this Forum.
Ok, and before I bore you both... all machines are FSM (finite state machines)now even if
... DOS is monotasking, MacOS mostly does cooperative multitasking and NewtonOS does preemptive multitasking.
the computer does and follows a specific routine... I'm pretty sure I can make MacOS/Newton run in monotask mode at any stage of the program execution... there are interupts on Newton hardware I presume... in this sense you can take over the NewtonOS and do whatever you want... as long as you set back the interupts to the state just before you started playing with them... therefore not needing the reboot that Paul mentioned. In this very sense, I can basically communicate straight to the hardware itself and not worry about GUI routines through NewtonScript the reason why I asked
Can you bypass Interface issues... say like writing to video memory directly.
Well, I think that about does it... I'll take a look at MPW and the ARM tools and maybe I'll find how to write to memory directly
cheers
|
|
"We are what we repeatedly do. Excellence then, is not an act, but a habit." Aristotle
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Dec 2000
Location: Paris, France
Status:
Offline
|
|
Now, I know that I require NewtonScript if I were to do the Application as a Newton Package. I think I have this right? Applications on Newton are considered packages?
Well, not exactly. Software are always in packages. Applications isn't something really pertinent to the NewtonOS. There are icons in the Extras Drawer, parts (of packages) of kind form, etc. But applications is much more a Mac concept than a Newton one.
But as for drawing to screen directly, as a programmer I find it hard to beleive that the only way to do it is through NewtonScript.
This is of course not the only way. You have three ways: NewtonScript, QuickDraw and video memory. But only the first is fully documented. The second one is doable and used in several programs such as Fractor, although I don't think it's documented anywhere and it's model dependant. The last one isn't documented anywhere and is highly model dependant.
Surely the Apple docs are not the only ones detailing on how to write code for Newton. I'm sure ARM have something (discussed below).
ARM has nothing to do with the screen. ARM is the processor. It's not even the heart of the Newtons.
Now I think I'm correct in saying that to run the code you need to transfer the code from Mac to Newton, and that MPW has no emulation mode for running code on Mac? If this is correct, its a shame.
No, it's cross development
Anyways within this evaluation CD... wait for it... the languages supported are C/C++/ARM assembly for ALL ARM cores... thats including StrongArm.
You'll need MPW tools to include the generated AIF into a Newton package (probably only AIFtoNTK). BTW, ARM SDT generates little endian code by default while the Newton does big endian. If you want to use gcc for arm (for example as a Metrowerks compiler), please note that it doesn't generate AIF files which are the only ones Newton C++ Tools can import (you can also use AOF files and the linker to make an AIF file).
In a nutshell: use ARM SDT port for MPW, a.k.a. Newton C++ Toolbox.
Ok, and before I bore you both... all machines are FSM (finite state machines)
I don't think so, but that's another story.
I'm pretty sure I can make MacOS/Newton run in monotask mode at any stage of the program execution... there are interupts on Newton hardware I presume... in this sense you can take over the NewtonOS and do whatever you want... as long as you set back the interupts to the state just before you started playing with them...
The functions to disable and re-enable interrupts are now accessible thanks to a header I have written for the NewtonDev archive. But I strongly advise you not to use them. Besides, using them means that the OS won't do anything for you, including managing the keyboard. And additionnally, you won't be in supervisor mode which means that some parts of the memory/hardware won't be available.
Paul
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|