home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #2 / amigaacscoverdisc1998-021998.iso / games / doom / adoom / amiga_notes.txt < prev    next >
Text File  |  1998-01-22  |  21KB  |  456 lines

  1. ========================================================================
  2. v0.8 22 Jan 98
  3. ------------------------------------------------------------------------
  4. Lowered volume of music in amiga_music.s, got rid of clicks.  Also
  5. lowered volume of sound effects in amiga_sound.c.  Only the lower half
  6. of the volume control was being used before.
  7.  
  8. ------------------------------------------------------------------------
  9. Now compile with OPTSCHEDULE sc option.
  10.  
  11. ------------------------------------------------------------------------
  12. Added code to amiga_video.c for -fps option for displaying frames per
  13. second in top-left corner.
  14.  
  15. ------------------------------------------------------------------------
  16. For 68040/68060 + AGA, now use comparison buffer C2P routine if window
  17. is smaller than SCREENSIZE-64, else use non-comparison buffer C2P.
  18.  
  19. ------------------------------------------------------------------------
  20. Disabled "S_StartSoundAtVolume: 16bit and not pre-cached - wtf?" msg
  21. in s_sound.c with -nosfx.
  22.  
  23. ------------------------------------------------------------------------
  24. Added -heapsize option in amiga_system.c for specifying zone size in
  25. kilobytes.
  26.  
  27. ------------------------------------------------------------------------
  28. Rewrote R_RenderSegLoop() (in r_segs.c) in assembly language (to
  29. amiga_draw.s) and hand-optimised it a bit.
  30.  
  31. ------------------------------------------------------------------------
  32. Fixed (harmless) missing #endif in d_main.c.
  33.  
  34. ------------------------------------------------------------------------
  35. There appears to be a bug in r_things.c.  The code:
  36.  
  37.     check = namelist;
  38.     while (*check != NULL)
  39.     check++;
  40.  
  41. scans for a NULL which doesn't exist on the end of the namelist array
  42. (unless you're lucky --- it's just whatever comes after the array in
  43. memory).  Fixed by making the sprnames[] array 1 element longer in
  44. info.c and info.h and initialising the last element to NULL.  I wonder
  45. if this fixed the "PNAMES not found" bug.
  46.  
  47. ------------------------------------------------------------------------
  48. Compiled everything with DATA=NEAR.  This involved finding the dozen
  49. or so largest data structures throughout all files and declaring them
  50. with FAR, so the remainder fitted within 64kb.  Added the following
  51. lines to doomdef.h:
  52.  
  53.     #ifdef __SASC
  54.     #define FAR __far
  55.     #else
  56.     #define FAR
  57.     #endif
  58.  
  59. Added #include "doomdef.h" to several files to get the FAR definition.
  60.  
  61. ------------------------------------------------------------------------
  62. Applied patch supplied by Aki to DrawColumn_060() in amiga_draw.s to
  63. fix problem with red stairs and random pixels on 68060.
  64.  
  65. ------------------------------------------------------------------------
  66. Changed most routines in amiga_draw.s to use near A4-relative
  67. addressing of variables.  Couldn't figure out how to do this with
  68. Macro68 (because DT base for A4 is external) so used SAS/C asm
  69. instead.  Had to convert back to old syntax and manually optimise
  70. branches.
  71.  
  72. ------------------------------------------------------------------------
  73. Applied patches supplied by Cyril Deble to d_main.c and am_map.c for
  74. new -rotatemap and -maponhu options.
  75.  
  76. ========================================================================
  77. v0.7 16 Jan 98
  78. ------------------------------------------------------------------------
  79. Version 0.6 had a serious bug in c2p8_040_amlaukka.s which caused
  80. crashes on 68040+AGA and 68060+AGA machines.  Fixed with patch
  81. supplied by Aki Laukkanen.
  82.  
  83. ------------------------------------------------------------------------
  84. Version 0.6 had a serious bug in the use_mmu cleanup code which caused
  85. crashes one exit when -mmu or MMU was used.  Fixed with patch supplied
  86. by Aki Laukkanen.
  87.  
  88. ------------------------------------------------------------------------
  89. Commenting out the Macro68 debug statements in the *.s files made the
  90. executable much smaller.
  91.  
  92. ========================================================================
  93. v0.6 15 Jan 98
  94. ------------------------------------------------------------------------
  95. Applied patches to amiga_music.s as supplied by Joe Fenton.
  96. Also added code to set correct frequency for PAL or NTSC instead of
  97. assuming NTSC.
  98.  
  99. ------------------------------------------------------------------------
  100. Applied patches to column and span drawing routines in amiga_draw.s as
  101. supplied by Aki Laukkanen.  This fixed all the bright dots scattered
  102. around floors and ceilings, and the red stairs at the start.  Disabled
  103. various routines in r_draw.c, r_segs.c and r_things.c that are
  104. replaced by routines in amiga_draw.s.
  105.  
  106. ------------------------------------------------------------------------
  107. Now use FPU for FixedMul() on 68060.  Joe Fenton says "2 FP multiplies
  108. beat the hell out of 4 word multiplies, plus the associated adds and
  109. swaps".  Added SetFPMode() routine to amiga_fixed.s to set FPU
  110. rounding mode to "round towards minus infinity".  Otherwise WAD demos
  111. got out of step and went wrong when using FPU for multiply.
  112.  
  113. ------------------------------------------------------------------------
  114. In p_map.c, undid the patch I made in version 0.0 by changing line:
  115.  
  116.     if (ld->special && numspechit < MAXSPECIALCROSS)
  117.  
  118. back to:
  119.  
  120.     if (ld->special)
  121.  
  122. Instead added code in p_map.c and p_enemy.c to check bounds of all
  123. spechit[] array accesses.  With MAXSPECIALCROSS == 8, got lots of
  124. array out of bounds accesses, especially in 2nd level of DOOM II.
  125. Changed MAXSPECIALCROSS from 8 to 20.  That got rid of them.
  126.  
  127. ------------------------------------------------------------------------
  128. After several hours of stepping through with CPR, finally found and
  129. fixed the bug that made the Doom II "Dead Simple" level impossible to
  130. complete.  For the function pointer comparison in the line:
  131.  
  132.     if (th->function.acp1 != (actionf_p1)P_MobjThinker)
  133.  
  134. in p_enemy.c, SAS/C generated code which compared acp1 with the
  135. address of the ALV (JMP instruction) for P_MobjThinker() instead of
  136. the address of the P_MobjThinker() function itself.  Thus the test
  137. always failed, even when the function pointers were the same.  Fixed
  138. by compiling everything with ABSFUNCPOINTER.
  139.  
  140. I reported this to Steve Krueger at SAS.  He replied:
  141.  
  142. "It's not a bug, but rather a limitation of the CODE=NEAR model. We
  143. even document this in the manual, and provide an option to work around
  144. it if you still want to use CODE=NEAR. Check the manual for
  145. information on the ABSFUNCTIONPOINTER option.
  146.  
  147. ------------------------------------------------------------------------
  148. Found and fixed the crash on exit bug when music is enabled.  Register
  149. a0 wasn't initialised to _custom in FreeChannels() in amiga_music.s.
  150.  
  151. ------------------------------------------------------------------------
  152. Added -nosfx option and tooltype for disabling sound effects and
  153. leaving audio channels free.
  154.  
  155. ------------------------------------------------------------------------
  156. Added Aki Laukkanen's code to amiga_video.c for marking screens[0] and
  157. the video raster as "imprecise" with the MMU when the -mmu option is
  158. specified.  This should create a slight speedup for 68060.
  159.  
  160. ------------------------------------------------------------------------
  161. Started adding code for -directcgx option for rendering directly to
  162. framebuffer of any video card running CyberGraphX.  Discovered it
  163. flickers badly and needs double or triple-buffering.  Started adding
  164. code for double-buffering, but didn't get logic for interaction with
  165. I_ReadScreen() right.  Still haven't got LockBitMapTags() and
  166. UnLockBitMap() called from the right places, so sometimes tries to
  167. write to framebuffer (screens[0]) while not locked.  This may corrupt
  168. other screens if you flip or drag screens while running with
  169. -directcgx.
  170.  
  171. ------------------------------------------------------------------------
  172. Applied patches from Aki Laukkanen to get low detail mode working.
  173. This included substantial changes to amiga_draw.s and r_draw.c.  The
  174. assembly routines Aki supplied for R_DrawFuzzColumn(),
  175. R_DrawFuzzColumnLow(), R_DrawTranslatedColumn() and
  176. R_DrawTranslatedColumnLow() didn't appear to work right, so reverted
  177. to C versions in r_draw.c.
  178.  
  179. ========================================================================
  180. v0.5  8 Jan 98
  181. ------------------------------------------------------------------------
  182. Added music code in amiga_music.s based on Joseph Fenton .MUS player.
  183. Changed amiga_sound.s to use only 2 channels for sound effects when
  184. music is enabled, and 4 channels when music is disabled.  Added
  185. MIDI_Instruments and MIDI_Instruments.s to archive.  MIDI_Instruments.s
  186. isn't actually used, but it's helpful for understanding the instrument
  187. format.
  188.  
  189. ------------------------------------------------------------------------
  190. Added Aki Laukkanen's latest 68040 and 68060-optimised column and span
  191. renderers in amiga_draw.s.  Modified r_main.c and r_draw.h to handle
  192. different DrawColumn_040(), DrawColumn_060(), DrawSpan_040() and
  193. DrawSpan_060().  Aki sent me some more fast C2P and MMU routines but I
  194. haven't got those working yet.
  195.  
  196. ------------------------------------------------------------------------
  197. The call to BestModeID() in amiga_video.c had an unterminated taglist.
  198. Fixed.
  199.  
  200. ------------------------------------------------------------------------
  201. Added Aki's 68060 versions of FixedMul() and FixedDiv() in amiga_fixed.s.
  202. 68060 FixedDiv uses FPU.  If there is no FPU, fall back to 68040 version.
  203. Added code to select appropriate routines in amiga_main.c.
  204. Changed FixedMul() definitions in m_fixed.h to look like this:
  205. extern fixed_t (*FixedMul)    (fixed_t a, fixed_t b);
  206. extern fixed_t (*FixedDiv)    (fixed_t a, fixed_t b);
  207. fixed_t FixedMul_040    (fixed_t a, fixed_t b);
  208. fixed_t FixedMul_060    (fixed_t a, fixed_t b);
  209. fixed_t FixedDiv_040    (fixed_t a, fixed_t b);
  210. fixed_t FixedDiv_060fpu    (fixed_t a, fixed_t b);
  211. /* fixed_t FixedDiv2    (fixed_t a, fixed_t b); */
  212.  
  213. ------------------------------------------------------------------------
  214. Added code to amiga_video.c to check version numbers before trying to
  215. call BestModeID() and put up a screenmode requester.  Explicitly
  216. declared LowLevelBase so it doesn't try and autoopen lowlevel.library.
  217.  
  218. ------------------------------------------------------------------------
  219. Fixed I_WaitVBL() in amiga_video.c to call WaitTOF().  It's only
  220. called on exit to delay long enough to hear the final sound effect.
  221.  
  222. ========================================================================
  223. v0.4
  224. ------------------------------------------------------------------------
  225. Gamma correction wasn't working in ECS mode.  Fixed in I_Palette()
  226. in amiga_video.c.
  227.  
  228. ------------------------------------------------------------------------
  229. I think I finally found the cause of the 80000003 crash on exit.  It
  230. was caused by 2 missing commas in the initialisation strings for
  231. endmsg[] in dstrings.c following the strings: "go ahead and leave. see
  232. if i care." and "you're lucky i don't smack\nyou for thinking about
  233. leaving.".  Fixed.
  234.  
  235. ------------------------------------------------------------------------
  236. Added 68020/30 optimised C2P routine in c2p_020.s.  Use blitter for
  237. final passes which means double-buffering is required to eliminate
  238. otherwise severe flicker.  Implemented double-buffering for all planar
  239. modes in amiga_video.c.
  240.  
  241. ------------------------------------------------------------------------
  242. Found that the last QBlit() pass finished while the main program was
  243. in the middle of 3D rendering.  This meant the ChangeScreenBuffer()
  244. call was delayed until the end of rendering.  The program felt very
  245. sluggish, even though the frame-rate was higher than before because
  246. there was a much longer delay between pressing a key and seeing the
  247. result happen on the screen.  To solve this I created a new subtask
  248. which simply calls ChangeScreenBuffer() in a loop when signalled from
  249. the QBlit() cleanup function.  This way the main engine is interrupted
  250. to call ChangeScreenBuffer() at the earliest opportunity.  Extensive
  251. changes are in amiga_video.c.
  252.  
  253. ------------------------------------------------------------------------
  254. Gabry (ggreco@iol.it) emailed me some CD32 joypad handling code.  I
  255. included it in amiga_video.c (disabled by default) but I can't test
  256. it.  To enable it, use the -joypad option or JOYPAD tooltype.
  257.  
  258. ------------------------------------------------------------------------
  259. Several people sent me faster replacements for R_DrawColumn() and
  260. R_DrawSpan() in amiga_draw.s, but so far only one of them worked
  261. right.
  262.  
  263. ========================================================================
  264. v0.3
  265. ------------------------------------------------------------------------
  266. Low detail code doesn't work, so disabled detail level toggle in
  267. m_menu.c.  Previously setting low detail and then resizing screen
  268. corrupted graphics.
  269.  
  270. ------------------------------------------------------------------------
  271. Added ClearPointer() call before CloseWindow() in amiga_video.c.
  272. Let's see if that fixes the crash on exit.  Hmm, seems OK after about
  273. a dozen runs.  Perhaps it was a bug in CyberGraphX.  ... nope, just
  274. got another 80000003 crash on exit  :(
  275.  
  276. ------------------------------------------------------------------------
  277. Added code to get ProgramName in amiga_main.c.  Added definition of
  278. ProgramName in m_args.h and m_args.c.
  279.  
  280. ------------------------------------------------------------------------
  281. Allocated space for myargv[] in amiga_main.c and copy argv[] across.
  282. Parse icon tooltypes and convert to additional entries in myargv[]
  283. and myargc.
  284.  
  285. ------------------------------------------------------------------------
  286. Added -screenmode option to set ScreenMode in amiga_video.c
  287.  
  288. ------------------------------------------------------------------------
  289. Added -forcedemo option in g_game.c to force demos to play even if
  290. the version number doesn't match.
  291.  
  292. ------------------------------------------------------------------------
  293. Changed handling of $HOME in d_main.c to append a '/' if it doesn't
  294. already end in a '/' or a ':'.
  295.  
  296. ------------------------------------------------------------------------
  297. Added trailing slashes to definitions of DEVMAPS and DEVDATA in
  298. dstrings.h.
  299. #define DEVMAPS "devmaps/"
  300. #define DEVDATA "devdata/"
  301.  
  302. ========================================================================
  303. v0.2   1 Jan 1998
  304. ------------------------------------------------------------------------
  305. Changed zone management code to allocate between 2Mb and 6Mb instead
  306. of always 6Mb.  ADoom should now work on Amigas with less memory.
  307. Check result of allocation.  Previous version crashed if 6Mb malloc
  308. failed.
  309.  
  310. ------------------------------------------------------------------------
  311. Changed handling of HOME environment variable in d_main.c
  312.  
  313. ------------------------------------------------------------------------
  314. The Amiga doesn't have F11 and F12 keys.  Changed amiga_video.c to map
  315. the '[' and ']' keys to F11 and F12.  Now gamma correction works.
  316. Also fixed keypad '+'.
  317.  
  318. ------------------------------------------------------------------------
  319. Added joystick code using gameport device in amiga_video.c.  Changed
  320. m_misc.c to enable usejoystick.
  321.  
  322. ------------------------------------------------------------------------
  323. Added AmiTCP networking support by writing a new version of
  324. amiga_net.c based on i_net.c for Linux.  Successfully worked to a PC
  325. running Linux with DOOM compiled from the released DOOM sources.
  326. Performance was really bad, with lots of jerking, even on ethernet.
  327. Tried improving performance by making sends non-blocking as well as
  328. recvs.  AmiTCP 4.3 appears to return errno==EINVAL instead of
  329. errno=EWOULDBLOCK for non-blocking recvfrom() and non-blocking
  330. sendto() --- seems pretty weird to me, or have I done something wrong?
  331.  
  332. ========================================================================
  333. v0.1  30 Dec 97
  334. ------------------------------------------------------------------------
  335. Open audio.device on 4 channels and play sound effects in
  336. amiga_sound.c.  Cache up to 12 sound effects in chipmem at a time.
  337. All other sound effects are cached in fastmem.  Audio period is still
  338. not calculated correctly from pitch.  Separation (balance) is ignored,
  339. so 3D sound effects are not right.  Changed s_sound.c to pass channel
  340. number (cnum) to I_StartSound().  Changed m_misc.c to set 4 channels
  341. instead of 3.
  342.  
  343. ------------------------------------------------------------------------
  344. Deleted calls to I_UpdateSound() and I_SubmitSound() in d_main.c
  345.  
  346. ------------------------------------------------------------------------
  347. Stripped 68040-optimised AGA and ECS(EHB) C2P routines out of Flick
  348. v1.5 and linked them into amiga_video.c.  Changed "dirty_list"
  349. mechanism to a comparison buffer instead.  Added amiga_median.c for
  350. calculating best EHB palette and 8-bit -> 6-bit colour xlate table.
  351. Changed EHB C2P routine to handle colour translate table (probably not
  352. entirely efficiently).  These routines are not quite state-of-the-art
  353. (e.g, old merge macro) but they are not bad either.  Linked in 68020-
  354. and Akiko-optimised routines too, but they are not called yet.
  355.  
  356. ------------------------------------------------------------------------
  357. Made a minor optimisation speedup to R_DrawColumn().
  358.  
  359. ========================================================================
  360. v0.0  28 Dec 97
  361. ------------------------------------------------------------------------
  362. Wrote amiga_main.c, amiga_system, amiga_sound.c, amiga_video.c,
  363. amiga_net.c and smakefile to replace i_main.c, i_system, i_sound.c,
  364. i_video.c, i_net.c and Makefile respectively.  The amiga_sound and
  365. amiga_net routines are dummies.
  366.  
  367. ------------------------------------------------------------------------
  368. Amiga is big-endian.  Compiled with DEFINE=__BIG_ENDIAN__.  It looks
  369. like the code hasn't been tested with __BIG_ENDIAN__ for a while.  The
  370. test in m_swap.c for whether swap routines should be included was
  371. around the wrong way.  SwapSHORT() returned an int instead of an
  372. unsigned short.
  373.  
  374. ------------------------------------------------------------------------
  375. Fixed point arithmetic routines in m_fixed.c used (long long) 64-bit
  376. datatype not available in SAS/C.  Replaced with assembly routines in
  377. amiga_fixed.s.  Added check for divide by 0 in FixedDiv() because
  378. Amiga crashes on divide by 0.
  379.  
  380. ------------------------------------------------------------------------
  381. The Unix function alloca() was called from r_data.c, w_wad.c and some
  382. other files.  I replaced with calls to malloc() and added calls to
  383. free() where each routine returns.
  384.  
  385. ------------------------------------------------------------------------
  386. Changed the cache routines in w_wad.c to use the more efficient
  387. fopen(), fread(), fseek(), fclose() instead of open(), read(),
  388. lseek(), close().  Changed handles from (int) to (FILE *) everywhere
  389. including lumpinfo_t structure in w_wad.h.  Fixed the filelength()
  390. function to align stat structure on 4-byte boundary.  Used SAS/C
  391. fileno() function to get file number from (FILE *).
  392.  
  393. ------------------------------------------------------------------------
  394. In d_main.c, changed the handling of slashes and double-dots in
  395. filenames to Amiga conventions.
  396.  
  397. ------------------------------------------------------------------------
  398. Moved definition of RANGECHECK from doomdef.h to smakefile.  Disabled
  399. SNDSERV and SNDINTR in doomdef.h.
  400.  
  401. ------------------------------------------------------------------------
  402. SAS/C 6.58 appeared to generate bad code for the line:
  403.  
  404.     offsetangle = abs(rw_normalangle-rw_angle1);
  405.  
  406. in r_segs.c, resulting in corrupted graphics.  This took me hours to
  407. track down.  Putting printf() instructions before and after, the code
  408. calulated abs(1073741824-1927746431)=1073741824 instead of the correct
  409. answer of 854004607.  As far as I could see, it was using the stdlib.h
  410. definition of abs(), which looks fine.  As a workaround, I changed
  411. abs() to iabs() (SAS/C function) throughout in all sources.
  412.  
  413. On 5 Jan 98, Michael van Elst <mlelstv@serpens.swb.de> offered the
  414. following explanation:
  415.  
  416. >It doesn't. It is an artefact of ANSI C. rw_normalangle is defined
  417. >as unsigned, rw_angle1 is defined as int. The result of the difference
  418. >is therefore unsigned. You need something like:
  419. >
  420. >    offsetangle = abs((int)rw_normalangle - (int)rw_angle1);
  421. >or  offsetangle = abs((long)rw_normalangle - (long)rw_angle1);
  422. >
  423. >and make sure that rw_normalangle fits into the positive int or
  424. >long values.
  425. >[...]
  426. >gcc probably doesn't use the macro but an abs(int) function. You
  427. >get the same with SAS/C if you #undef abs.
  428.  
  429. ------------------------------------------------------------------------
  430. Got READ enforcer hits in p_enemy.c at the line:
  431.  
  432.         ld = spechit[numspechit];
  433.  
  434. Crashed badly shortly afterwards if Enforcer was not running.  As far
  435. as I can tell, the variable numspechit should be in the range 0..7.
  436. Somehow numspechit gets the value 149551680 (0x8e9fa40).  Without
  437. really knowing what I was doing, I attempted to fix the problem by
  438. changing the line:
  439.  
  440.     if (ld->special)
  441.  
  442. in p_map.c to:
  443.  
  444.     if (ld->special && numspechit < MAXSPECIALCROSS)
  445.  
  446. So far it seems to work.
  447.  
  448. ------------------------------------------------------------------------
  449. Disassembled R_DrawColumn() and R_DrawSpan() with OMD, created
  450. amiga_draw.s and hand-optimised a bit.
  451.  
  452. ------------------------------------------------------------------------
  453. Program still often crashes on exit   :(
  454.  
  455. ------------------------------------------------------------------------
  456.