home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2643 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  6.3 KB

  1. Path: easy.in-chemnitz.de!mkmk!floh
  2. From: floh@mkmk.in-chemnitz.de (Andre Weissflog)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Multiplatform Development
  5. Message-ID: <Qqi1y*3F0@mkmk.in-chemnitz.de>
  6. Date: Fri, 02 Feb 1996 01:15:32 CET
  7. Reply-To: floh@mkmk.in-chemnitz.de
  8. References: <4eqr9u$s25@sundog.tiac.net>
  9. Distribution: world
  10. Organization: private uucp site
  11. X-Newsreader: Arn V 1.04
  12.  
  13. In article <4eqr9u$s25@sundog.tiac.net>, Darius Taghavy writes:
  14.  
  15. > Does anyone have experience with multiplatform application development?
  16. > I currently have a large Amiga app (not yet released) that I am 
  17. > considering to port to one or more of Mac/Be/NT/OS2.
  18. > I will keep developing on and for the Amiga, but real life economics
  19. > require me to consider some of these other platforms.
  20. > Main questions:
  21. > a) Graphics
  22. >    what is the graphics API like in these other systems?
  23. >    I.e. On the Amiga we use Move(), Draw(),RectFill(),Text() etc.
  24. >    all of which use a struct RastPort * as first argument.
  25. >    I have already abstracted this layer. For example, I have
  26. >    a text display routine that gets (rastport pointer, x,y, text 
  27. >    pointer) arguments.
  28. >    Do these other API's also use a single handle, such as RastPort?
  29. >         Mac: ?
  30. >         NT:  ?
  31. >         OS2: ?
  32. >         Be:  ?
  33. The graphics APIs should be very different, but there should always
  34. be an actual "graphics context" like a RastPort on the Amiga,
  35. and a set of functions that work on it (on the Be, you will
  36. have C++ objects for that).
  37.  
  38. It may be worth it to write stub functions that have the
  39. same interface as their Amiga counterparts, but translate
  40. the call to the specific OS environment. I have done this
  41. for a subset of iffparse.library functions on the PC,
  42. it works pretty well. The problem with this approach is that
  43. you are basically reinventing the wheel, and the new wheel
  44. will never be as good as the existing one, since you
  45. only have a black box to start from.
  46.  
  47. The other approach would be to write a system indepent
  48. library of primitive functions, and use only those functions
  49. in your higher level application code. Then rewrite the library 
  50. for every new platform.
  51.  
  52. > b) Event Handling
  53.  
  54. Can't really serve with this one.
  55.  
  56. > c) Interrupts/Timers
  57. >    My app uses multiple tasks and interrupts. For a non-multi-tasking
  58. >    OS I could still work, as I can conditionally compile into a
  59. >    single task/multiple interrupt model already.
  60. >    Basically, what I need is:
  61. >     - *hardware* timer interrupt
  62.         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  63. That's a problem on PCs under (at least) MS-DOS. You only
  64. have the system clock running at 18.2Hz. If you want better
  65. resolution, you'll have to hit the hardware directly and
  66. install your own timer interrupt server. Nasty...
  67.  
  68. >     - serial interrupt when receive buffer is full  
  69. >     - serial interrupt when transmit buffer is full
  70. Sorry, no idea.
  71.  
  72. > d) CPU/Memory Architecture
  73. >    I love architectures that are based on a linear address
  74. >    space using the 68K family. I use a lot of pointers and
  75. >    have no intention to ever code for a 16 bit OS.
  76. >    I have heard horror stories about Intel processors and
  77. >    have been fortunate to never having had to code for one.
  78.  
  79. Should be no problem under OS/2, or even Win3.1 386. The 
  80. only thing is, you must run in protected mode with
  81. flat memory model, "modern" OS's do this all the time, for
  82. DOS-apps you'll need a DOS extender. It's really not that
  83. horrifying, with Watcom C for instance, you just say
  84. something like "link as 32bit DOS application running under
  85. DOS4GW", and the compiler will do the rest for you, selecting
  86. the right link libraries etc. You can malloc() memory blocks
  87. as big as you want them, and pointer arithmetics works
  88. just fine, like on real computers. Assembly coding
  89. is actually easier in flat memory model, since you don't
  90. need to mess around with segment registers.
  91.  
  92. It only gets tricky if you want to access exotic BIOS functions,
  93. or (just for example) want to use VESA2.0 calls. But that's
  94. all MS-DOS babble...
  95.  
  96. >    Does NT abstract this somehow? Can you just declare
  97. >    long *whatever; and then reference is the same way as on
  98. >    the ami? Or do you have to deal with memory banks etc and
  99.  
  100. Yes, should work on all systems except MS-DOS without
  101. DOS-extender. Just define your pointers, and fool around
  102. with them.
  103.  
  104. >    contruct a pointer from that. If I had to call a function
  105. >    for every pointer I need it would be too slow and I wouldn't
  106. >    even consider such a rediclious environment.
  107. No problem in protected mode, technically you'll still
  108. have segments, but only one for each code, data and stack, and at
  109. least code and data start both at address 0 and go linearly up to
  110. 4GB. Pointers are always 32 bit.
  111.  
  112. > e) Source Code Database
  113. >    How do you actually compile for the different targets?
  114. >    Since there are no multiplatform compilers on the Amiga
  115. >    such as the ones I looked at on Windows/OS2/Mac, how do
  116. >    you maintain a single code base? (I do not like "cut and
  117. >    paste" development).
  118. Can be tricky to avoid. First, there's #ifdef, but of
  119. course the code will soon be unreadable if there are
  120. too many of them. I use a central "sys.h" header, where
  121. I try to encapsulate some system specific things into
  122. macros.
  123.  
  124. >    What comes to mind is to network the Amiga with the other
  125. >    machine(s), then run the compiler on the other machine,
  126. >    accessing the files stored on an Amiga filesystem and store
  127. >    the object code in separate subdirs (one for each target).
  128. This should work.
  129. Currently I have wired the PC via serial line to my Amiga
  130. and transfer all changes on the sources to the PC, which 
  131. is only used for compiling and some debugging. The ultimate
  132. goal for me is to have only one source base, and either cross 
  133. compile, or compile over a NFS link.
  134.  
  135. > There are other issues. I just typed up the ones that came to
  136. > mind immediately. But this should be enough to get a discussion
  137. > started. A public discussion for the benefit of everyone would be
  138. > great, but if you like to help and stay anonymous for whatever
  139. > reason, I would appreciate private e-mail, even if it's just a
  140. > short hint or two.
  141.  
  142. Hope it helped,
  143. -Floh.
  144.  
  145. ====//=== Andre Weissflog <floh@mkmk.in-chemnitz.de> =======
  146. ...// Sep'95: Return Of The Living Death...................
  147. \\// 90% of everything is crap (Sturgeon's Law)...........
  148. =\\===============================================Amiga!=
  149.  
  150.