[Newbie] Hello... I am lost.
Posted: Sat Nov 24, 2018 7:09 am
Hi All,
So I've wanted to get into development for AmigaOS since I did the retro kick in 2007 or so. The retro kick is gone now, and I want to focus on developing for PPC OS4.x. I have my eye on a project on the OpenAmiga.org site, but I'm nowhere near competent enough to even volunteer yet. I've studied Comp Sci at Uni for 2 years, and learned Pascal, C, C++ and Java during that time. I learned some data structures and algorithm complexity analysis etc, so have a decent grasp on pointers and objects and OO programming etc. I haven't progressed past this, and it's been a LONG time since I was doing ANY of it, so I'm also firing up some old neuron paths to get back up to speed with programming in C. C is where I want to be.
I cannot afford a NG AmigaOne system at this time, but since WinUAE is now able to emulate PPC Classic environment successfully, I took the plunge and bought myself a copy of AmigaOS 4.1 FE and set up a development environment with SDK.
I've made a few simple programs which work well, but are probably wrong (creating a linked list but not destroying it at program end - potential memory leak I'm guessing), but it's a start.
My first project involves a simple GUI application to get the hang of how to open libraries and setup windows/gadgets etc and refresh the same as the program runs. And here is where the problem begins.
Trying to sift through all of the out of date and wrong (obsolete/deprecated/just plain bad) coding examples for 68k and PPC, the RKRMs (Exec, Devices, Libraries), the AmigaOS Wiki, OS4Coding.net, Jim Tubbs Reaction guide and more, I'm really struggling to get a cohesive understanding in my mind about how to do things, and do them correctly. I haven't looked at source code, because I don't want to pick something that's wrong, and I likely will because I don't know it's wrong.
I'm willing to do all of this footwork, because it really is enlightening, and I've learned a lot so far, but I keep hitting dead ends, and I don't even know how to look for the answer. There are enough posts saying "don't do this anymore, do this" but the code snippets aren't comprehensive for me to understand how to get to the place to do the wrong or right thing.
The questions I have right now, and I'm sure there'll be many more once I work them out are:
1) Automatically linked libraries and the use of Interfaces
There is an old way (Exec functions) and new way to (Exec Interface calling functions) open libraries using Interfaces. Many examples have IExec->OpenLibrary(...). Where does IExec come from? I seem to recall while reading through the SAS/C 6.5x docos (originally started working on a 2.05 environment - Hence SAS/C) that there is an amiga.lib which is automatically linked, or should be linked everytime if you don't rely on SAS/C to handle the linking for you. I found a reference in the AmigaOS wiki that the amiga.lib and debug.lib are "obsolete". I've tried to search for info regarding gcc and OS4.x and automatically linked libraries, but haven't succeeded yet (other than finding that -lauto and -lraauto are incomplete solutions, and possibly link libraries you will never use, and should now be avoided.)
There's a page on creating a custom library on AmigaOS Wiki that says IExec isn't automatically present in libraries like it is in a normal program, and shows how to 'open' it.
So, where _is_ IExec coming from? Is it automatic? Is this deprecated behaviour which should be avoided? Are there any other 'automatic' includes/linked libraries I should be aware of? Is there a decent place to find such information? If I were to use the IExec setup in custom library page, for a normal program would that be acceptable, redundant, undesirable?
2) How does Wait() work? The examples say effectively 'your program halts execution and waits for a signal from Intuition, when the user presses a button or something, you handle it with your code' and they make a simple example which for eg makes a window and Waits() for a close gadget and they handle JUST that gadget, close everything up and quit. They are describing Wait() from the system's perspective. The examples don't do anything beyond Intuition signalling specific things, and so I don't know how _my_ program fits in with that.
My guess, and please correct me if I'm wrong, is that Wait() halts the execution, hands the system back to Exec and then in 1/10 second (or something) Exec wakes the program back up. If there's no user interaction, the program is still woken, given NULL flags, the program can do what it needs (the actual purpose of the program) and then it loops back to Wait() for another 1/10 second. Of course if it gets signals, it also has to handle those during it's run loop. Does this sound accurate?
I'd like an in-depth explanation of how Wait() works, from the point of view of my program, not from the point of view of the system.
So there it is, the current and beginning questions from an Amiga developer newbie.
I have had some issues with the WinUAE setup, so if anyone wants to help out there, I'd be grateful. A classic example is running Codebench, when I compile my crappy code using Codebench functionality, and gcc returns errors, Codebench returns to the editor screen and crashes the system. Many things seem to crash the system. I'm stuck using Notepad and command-line gcc commands for now, but I'm ok with that (for now )
Many thanks,
tiffers
So I've wanted to get into development for AmigaOS since I did the retro kick in 2007 or so. The retro kick is gone now, and I want to focus on developing for PPC OS4.x. I have my eye on a project on the OpenAmiga.org site, but I'm nowhere near competent enough to even volunteer yet. I've studied Comp Sci at Uni for 2 years, and learned Pascal, C, C++ and Java during that time. I learned some data structures and algorithm complexity analysis etc, so have a decent grasp on pointers and objects and OO programming etc. I haven't progressed past this, and it's been a LONG time since I was doing ANY of it, so I'm also firing up some old neuron paths to get back up to speed with programming in C. C is where I want to be.
I cannot afford a NG AmigaOne system at this time, but since WinUAE is now able to emulate PPC Classic environment successfully, I took the plunge and bought myself a copy of AmigaOS 4.1 FE and set up a development environment with SDK.
I've made a few simple programs which work well, but are probably wrong (creating a linked list but not destroying it at program end - potential memory leak I'm guessing), but it's a start.
My first project involves a simple GUI application to get the hang of how to open libraries and setup windows/gadgets etc and refresh the same as the program runs. And here is where the problem begins.
Trying to sift through all of the out of date and wrong (obsolete/deprecated/just plain bad) coding examples for 68k and PPC, the RKRMs (Exec, Devices, Libraries), the AmigaOS Wiki, OS4Coding.net, Jim Tubbs Reaction guide and more, I'm really struggling to get a cohesive understanding in my mind about how to do things, and do them correctly. I haven't looked at source code, because I don't want to pick something that's wrong, and I likely will because I don't know it's wrong.
I'm willing to do all of this footwork, because it really is enlightening, and I've learned a lot so far, but I keep hitting dead ends, and I don't even know how to look for the answer. There are enough posts saying "don't do this anymore, do this" but the code snippets aren't comprehensive for me to understand how to get to the place to do the wrong or right thing.
The questions I have right now, and I'm sure there'll be many more once I work them out are:
1) Automatically linked libraries and the use of Interfaces
There is an old way (Exec functions) and new way to (Exec Interface calling functions) open libraries using Interfaces. Many examples have IExec->OpenLibrary(...). Where does IExec come from? I seem to recall while reading through the SAS/C 6.5x docos (originally started working on a 2.05 environment - Hence SAS/C) that there is an amiga.lib which is automatically linked, or should be linked everytime if you don't rely on SAS/C to handle the linking for you. I found a reference in the AmigaOS wiki that the amiga.lib and debug.lib are "obsolete". I've tried to search for info regarding gcc and OS4.x and automatically linked libraries, but haven't succeeded yet (other than finding that -lauto and -lraauto are incomplete solutions, and possibly link libraries you will never use, and should now be avoided.)
There's a page on creating a custom library on AmigaOS Wiki that says IExec isn't automatically present in libraries like it is in a normal program, and shows how to 'open' it.
So, where _is_ IExec coming from? Is it automatic? Is this deprecated behaviour which should be avoided? Are there any other 'automatic' includes/linked libraries I should be aware of? Is there a decent place to find such information? If I were to use the IExec setup in custom library page, for a normal program would that be acceptable, redundant, undesirable?
2) How does Wait() work? The examples say effectively 'your program halts execution and waits for a signal from Intuition, when the user presses a button or something, you handle it with your code' and they make a simple example which for eg makes a window and Waits() for a close gadget and they handle JUST that gadget, close everything up and quit. They are describing Wait() from the system's perspective. The examples don't do anything beyond Intuition signalling specific things, and so I don't know how _my_ program fits in with that.
My guess, and please correct me if I'm wrong, is that Wait() halts the execution, hands the system back to Exec and then in 1/10 second (or something) Exec wakes the program back up. If there's no user interaction, the program is still woken, given NULL flags, the program can do what it needs (the actual purpose of the program) and then it loops back to Wait() for another 1/10 second. Of course if it gets signals, it also has to handle those during it's run loop. Does this sound accurate?
I'd like an in-depth explanation of how Wait() works, from the point of view of my program, not from the point of view of the system.
So there it is, the current and beginning questions from an Amiga developer newbie.
I have had some issues with the WinUAE setup, so if anyone wants to help out there, I'd be grateful. A classic example is running Codebench, when I compile my crappy code using Codebench functionality, and gcc returns errors, Codebench returns to the editor screen and crashes the system. Many things seem to crash the system. I'm stuck using Notepad and command-line gcc commands for now, but I'm ok with that (for now )
Many thanks,
tiffers