======================================================================== v0.5 8 Jan 98 ------------------------------------------------------------------------ Added music code in amiga_music.s based on Joseph Fenton .MUS player. Changed amiga_sound.s to use only 2 channels for sound effects when music is enabled, and 4 channels when music is disabled. Added MIDI_Instruments and MIDI_Instruments.s to archive. MIDI_Instruments.s isn't actually used, but it's helpful for understanding the instrument format. ------------------------------------------------------------------------ Added Aki Laukkanen's latest 68040 and 68060-optimised column and span renderers in amiga_draw.s. Modified r_main.c and r_draw.h to handle different DrawColumn_040(), DrawColumn_060(), DrawSpan_040() and DrawSpan_060(). Aki sent me some more fast C2P and MMU routines but I haven't got those working yet. ------------------------------------------------------------------------ The call to BestModeID() in amiga_video.c had an unterminated taglist. Fixed. ------------------------------------------------------------------------ Added Aki's 68060 versions of FixedMul() and FixedDiv() in amiga_fixed.s. 68060 FixedDiv uses FPU. If there is no FPU, fall back to 68040 version. Added code to select appropriate routines in amiga_main.c. Changed FixedMul() definitions in m_fixed.h to look like this: extern fixed_t (*FixedMul) (fixed_t a, fixed_t b); extern fixed_t (*FixedDiv) (fixed_t a, fixed_t b); fixed_t FixedMul_040 (fixed_t a, fixed_t b); fixed_t FixedMul_060 (fixed_t a, fixed_t b); fixed_t FixedDiv_040 (fixed_t a, fixed_t b); fixed_t FixedDiv_060fpu (fixed_t a, fixed_t b); /* fixed_t FixedDiv2 (fixed_t a, fixed_t b); */ ------------------------------------------------------------------------ Added code to amiga_video.c to check version numbers before trying to call BestModeID() and put up a screenmode requester. Explicitly declared LowLevelBase so it doesn't try and autoopen lowlevel.library. ------------------------------------------------------------------------ Fixed I_WaitVBL() in amiga_video.c to call WaitTOF(). It's only called on exit to delay long enough to hear the final sound effect. ======================================================================== v0.4 ------------------------------------------------------------------------ Gamma correction wasn't working in ECS mode. Fixed in I_Palette() in amiga_video.c. ------------------------------------------------------------------------ I think I finally found the cause of the 80000003 crash on exit. It was caused by 2 missing commas in the initialisation strings for endmsg[] in dstrings.c following the strings: "go ahead and leave. see if i care." and "you're lucky i don't smack\nyou for thinking about leaving.". Fixed. ------------------------------------------------------------------------ Added 68020/30 optimised C2P routine in c2p_020.s. Use blitter for final passes which means double-buffering is required to eliminate otherwise severe flicker. Implemented double-buffering for all planar modes in amiga_video.c. ------------------------------------------------------------------------ Found that the last QBlit() pass finished while the main program was in the middle of 3D rendering. This meant the ChangeScreenBuffer() call was delayed until the end of rendering. The program felt very sluggish, even though the frame-rate was higher than before because there was a much longer delay between pressing a key and seeing the result happen on the screen. To solve this I created a new subtask which simply calls ChangeScreenBuffer() in a loop when signalled from the QBlit() cleanup function. This way the main engine is interrupted to call ChangeScreenBuffer() at the earliest opportunity. Extensive changes are in amiga_video.c. ------------------------------------------------------------------------ Gabry (ggreco@iol.it) emailed me some CD32 joypad handling code. I included it in amiga_video.c (disabled by default) but I can't test it. To enable it, use the -joypad option or JOYPAD tooltype. ------------------------------------------------------------------------ Several people sent me faster replacements for R_DrawColumn() and R_DrawSpan() in amiga_draw.s, but so far only one of them worked right. ======================================================================== v0.3 ------------------------------------------------------------------------ Low detail code doesn't work, so disabled detail level toggle in m_menu.c. Previously setting low detail and then resizing screen corrupted graphics. ------------------------------------------------------------------------ Added ClearPointer() call before CloseWindow() in amiga_video.c. Let's see if that fixes the crash on exit. Hmm, seems OK after about a dozen runs. Perhaps it was a bug in CyberGraphX. ... nope, just got another 80000003 crash on exit :( ------------------------------------------------------------------------ Added code to get ProgramName in amiga_main.c. Added definition of ProgramName in m_args.h and m_args.c. ------------------------------------------------------------------------ Allocated space for myargv[] in amiga_main.c and copy argv[] across. Parse icon tooltypes and convert to additional entries in myargv[] and myargc. ------------------------------------------------------------------------ Added -screenmode option to set ScreenMode in amiga_video.c ------------------------------------------------------------------------ Added -forcedemo option in g_game.c to force demos to play even if the version number doesn't match. ------------------------------------------------------------------------ Changed handling of $HOME in d_main.c to append a '/' if it doesn't already end in a '/' or a ':'. ------------------------------------------------------------------------ Added trailing slashes to definitions of DEVMAPS and DEVDATA in dstrings.h. #define DEVMAPS "devmaps/" #define DEVDATA "devdata/" ======================================================================== v0.2 1 Jan 1998 ------------------------------------------------------------------------ Changed zone management code to allocate between 2Mb and 6Mb instead of always 6Mb. ADoom should now work on Amigas with less memory. Check result of allocation. Previous version crashed if 6Mb malloc failed. ------------------------------------------------------------------------ Changed handling of HOME environment variable in d_main.c ------------------------------------------------------------------------ The Amiga doesn't have F11 and F12 keys. Changed amiga_video.c to map the '[' and ']' keys to F11 and F12. Now gamma correction works. Also fixed keypad '+'. ------------------------------------------------------------------------ Added joystick code using gameport device in amiga_video.c. Changed m_misc.c to enable usejoystick. ------------------------------------------------------------------------ Added AmiTCP networking support by writing a new version of amiga_net.c based on i_net.c for Linux. Successfully worked to a PC running Linux with DOOM compiled from the released DOOM sources. Performance was really bad, with lots of jerking, even on ethernet. Tried improving performance by making sends non-blocking as well as recvs. AmiTCP 4.3 appears to return errno==EINVAL instead of errno=EWOULDBLOCK for non-blocking recvfrom() and non-blocking sendto() --- seems pretty weird to me, or have I done something wrong? ======================================================================== v0.1 30 Dec 97 ------------------------------------------------------------------------ Open audio.device on 4 channels and play sound effects in amiga_sound.c. Cache up to 12 sound effects in chipmem at a time. All other sound effects are cached in fastmem. Audio period is still not calculated correctly from pitch. Separation (balance) is ignored, so 3D sound effects are not right. Changed s_sound.c to pass channel number (cnum) to I_StartSound(). Changed m_misc.c to set 4 channels instead of 3. ------------------------------------------------------------------------ Deleted calls to I_UpdateSound() and I_SubmitSound() in d_main.c ------------------------------------------------------------------------ Stripped 68040-optimised AGA and ECS(EHB) C2P routines out of Flick v1.5 and linked them into amiga_video.c. Changed "dirty_list" mechanism to a comparison buffer instead. Added amiga_median.c for calculating best EHB palette and 8-bit -> 6-bit colour xlate table. Changed EHB C2P routine to handle colour translate table (probably not entirely efficiently). These routines are not quite state-of-the-art (e.g, old merge macro) but they are not bad either. Linked in 68020- and Akiko-optimised routines too, but they are not called yet. ------------------------------------------------------------------------ Made a minor optimisation speedup to R_DrawColumn(). ======================================================================== v0.0 28 Dec 97 ------------------------------------------------------------------------ Wrote amiga_main.c, amiga_system, amiga_sound.c, amiga_video.c, amiga_net.c and smakefile to replace i_main.c, i_system, i_sound.c, i_video.c, i_net.c and Makefile respectively. The amiga_sound and amiga_net routines are dummies. ------------------------------------------------------------------------ Amiga is big-endian. Compiled with DEFINE=__BIG_ENDIAN__. It looks like the code hasn't been tested with __BIG_ENDIAN__ for a while. The test in m_swap.c for whether swap routines should be included was around the wrong way. SwapSHORT() returned an int instead of an unsigned short. ------------------------------------------------------------------------ Fixed point arithmetic routines in m_fixed.c used (long long) 64-bit datatype not available in SAS/C. Replaced with assembly routines in amiga_fixed.s. Added check for divide by 0 in FixedDiv() because Amiga crashes on divide by 0. ------------------------------------------------------------------------ The Unix function alloca() was called from r_data.c, w_wad.c and some other files. I replaced with calls to malloc() and added calls to free() where each routine returns. ------------------------------------------------------------------------ Changed the cache routines in w_wad.c to use the more efficient fopen(), fread(), fseek(), fclose() instead of open(), read(), lseek(), close(). Changed handles from (int) to (FILE *) everywhere including lumpinfo_t structure in w_wad.h. Fixed the filelength() function to align stat structure on 4-byte boundary. Used SAS/C fileno() function to get file number from (FILE *). ------------------------------------------------------------------------ In d_main.c, changed the handling of slashes and double-dots in filenames to Amiga conventions. ------------------------------------------------------------------------ Moved definition of RANGECHECK from doomdef.h to smakefile. Disabled SNDSERV and SNDINTR in doomdef.h. ------------------------------------------------------------------------ SAS/C 6.58 appeared to generate bad code for the line: offsetangle = abs(rw_normalangle-rw_angle1); in r_segs.c, resulting in corrupted graphics. This took me hours to track down. Putting printf() instructions before and after, the code calulated abs(1073741824-1927746431)=1073741824 instead of the correct answer of 854004607. As far as I could see, it was using the stdlib.h definition of abs(), which looks fine. As a workaround, I changed abs() to iabs() (SAS/C function) throughout in all sources. On 5 Jan 98, Michael van Elst offered the following explanation: >It doesn't. It is an artefact of ANSI C. rw_normalangle is defined >as unsigned, rw_angle1 is defined as int. The result of the difference >is therefore unsigned. You need something like: > > offsetangle = abs((int)rw_normalangle - (int)rw_angle1); >or offsetangle = abs((long)rw_normalangle - (long)rw_angle1); > >and make sure that rw_normalangle fits into the positive int or >long values. >[...] >gcc probably doesn't use the macro but an abs(int) function. You >get the same with SAS/C if you #undef abs. ------------------------------------------------------------------------ Got READ enforcer hits in p_enemy.c at the line: ld = spechit[numspechit]; Crashed badly shortly afterwards if Enforcer was not running. As far as I can tell, the variable numspechit should be in the range 0..7. Somehow numspechit gets the value 149551680 (0x8e9fa40). Without really knowing what I was doing, I attempted to fix the problem by changing the line: if (ld->special) in p_map.c to: if (ld->special && numspechit < MAXSPECIALCROSS) So far it seems to work. ------------------------------------------------------------------------ Disassembled R_DrawColumn() and R_DrawSpan() with OMD, created amiga_draw.s and hand-optimised a bit. ------------------------------------------------------------------------ Program still often crashes on exit :( ------------------------------------------------------------------------