From: sparky4 Date: Thu, 31 Aug 2017 21:18:45 +0000 (-0500) Subject: worked on SD abit so the irq0 is not needed in imfplay anymore. I will need to merge... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=6718b47ac54c26b5390df9beb7a456d71c02d173;p=16.git worked on SD abit so the irq0 is not needed in imfplay anymore. I will need to merge ID_SD with p16 and use opl2 and PC speaker parts of SD. i found an adlib catcher and it records it to a RAW format file. it is called rac and it is located in 16/rac --- diff --git a/16/rac/D-INFO.TXT b/16/rac/D-INFO.TXT new file mode 100755 index 00000000..b4412127 --- /dev/null +++ b/16/rac/D-INFO.TXT @@ -0,0 +1,199 @@ + + + * * + * * * + * * * + ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ + ÛÛÛÛÛÛÜ ßßß ÛÛÜ ÜÛÛ ÛÛÛßßß ÛÛÛÜÛ Û ÜÜÜÛÜÜÜÛ Ü Û ßÛ ÛÛ + ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛÛÛÛÛÛ ÛÛÛßß ÛÛÛÛ Û Û Û Û Û Ü ÛÛ + ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛÞÝÛÛÛ ÛÛÛ ÛÛÛ Û ÛÛÛÛ Û Û Û Û ÛÛ ÛÛ + ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ Û ÛÛÛÛ Û Û Û Û ÛÛ ÛÛ + ÛÛÛÛÛÛß ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛÛÛÛ ÛÛÛ Û Û Û Û Û ÛÛ ÛÛ + ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß + + + ? t h e p o w e r s + ------------------------------------------------------------------------------ + + assassin the druid + rdos the mage + ondar he is a bartender + haberman it might be that. + + + + I t h e i d e a + ------------------------------------------------------------------------------ + + we are a couple of friends knowing each other for years, working together on + software projects nowadays. we all are busy studying yet, so don't expect a + bunch of new releases every month. our goal is to deliver quality productions + on both pc-demo / pc-commercial scene time by time. + + +  p r o d u c t i o n s + ------------------------------------------------------------------------------ + + [ important releases in 1995 ] + + rumb117i.zip* 55kb jun memory manager, gives you upper memory without + protected mode masters such as qemm / emm386 + + rumb118i.zip* 60kb sep updated version (more boards as well) + + rumb119i.zip* 57kb dec next updated version. man this look so serious. + + + [ important releases in 1996 ] + + rumb11dc.zip* 54kb jun a new one with more boards support + + + [ important releases in 1997 ] + + rumb11ea.zip 54kb jan another new version, now not only demo!!! + + * marked product is commercial or shareware - expect only partialy working + demo-version in this free package. + + +-------------------------------------------------------------------------------- + IMPORTANT NOTE TO ALL DISTRIBUTORS OF OUR PRODUCTS! PLEASE REMOVE EVERY + OUR SINGLE PRODUCTION NOT MENTIONED IN THIS LIST FROM YOUR BOARD. IT IS + NO MORE OFFICIAL RELEASE OF US (WE SHAME FOR IT :-). THANK YOU ... +-------------------------------------------------------------------------------- + + + +  b u l l e t i n b o a r d s + ------------------------------------------------------------------------------ + get our productions on these sites worldwide. + ( alphabetical order ) + + a.c.e. +33-1-45887-5484 28k8 france, hq gandalf + a touch of eternity +46-18-240037 28k8 sweden, hq drain + count zero +47-5512-2962 28k8 norway yitzhaq, calvin + digital fuse +32-2-7570-776 28k8 belgium, hq dr.vibe, mmouse + genesis +32-2-2453-498 28k8 belgium, ehq darkness + mostly harmless +46-8-6369-011 28k8 sweden thefreak + shoebox universe #1 +43-1-8928-998 33k6 austria eliot + shoebox universe #2 +43-1-8924-204 14k4 reebok + space bar +47-6493-3499 33k6 norway, hq hybris + surfers dream +46-(0)300-21883 28k8 sweden balrog + velvet demosite +32-3-38515-94 28k8 belgium sdog + + please contact us, if you want to become our site and/or hq. send us some bbs + info and your personalities. you have to include your bbs advertisement, too. + + + + ð i n t e r n e t + ------------------------------------------------------------------------------ + every our single release is also available on the net. + + ftp://sorry.vse.cz/dimension + http://sorry.vse.cz/dimension + + + tunes released by assassin for tm (three musicians) available on: + + ftp://fm.org/pub/music/tm + + + you may also visit the file section of ircbot _gore on #daskmig + + directory: /dimension + + +  t o u c h u s + ------------------------------------------------------------------------------ + contact our team using the following ways. + + + internet email: + + dv@pf.jcu.cz (general requests, commercials..) + dv@pf.jcu.cz (assassin) + roman@sorry.vse.cz (rdos, rdosumb, rdosplay, remus etc.) + xstao02@sorry.vse.cz (ondar) + xkovacic@dinf.fst.cvut.cz (haberman fans) + + snail mail: + + (assassin) (rdos) (ondar) (haberman) + david voracek roman dolejsi ondrej stasek jiri kovacicin + branisovska 50 husova 419 j.dietricha 4 xxxxmovingxxxx + 370 05 c budejovice 373 82 vcelna 370 08 c budejovice xxxxmovingxxxx + czech republic czech republic czech republic czech republic + + internet relay chat: + + meet us on irc channels #daskmig and #coders, or leave a note for assassin + on ircbot _gore present on #daskmig. + + +  g r e e t i n g s + ------------------------------------------------------------------------------ + + + ÛÛßßÛÜ from assassin + ÛÛ ÛÛ + ÛÛÜÜÛß rain, axl, asyntote, balrog, moebius, basehead, necros + sunday, zodiak, recc, cutnpaste, dune, derpiipo, vic, mellow-d + spinny, charon, gandalf, pellicus, pit bull, naali, lemming, aap + fuckeer, reebok, hybris, lizardking, naali, pelusa, nahkamuum + primon, beatnik, hachazo, distance, thefear, skaven, sleeping dog + alex dusty, darkness, laser harp, big jim, sikamikanico, wizard + eliott, tdj, leviathan, desmond, jare, tmk, hoplite, jmag + mikmak, hachazo, svarvarn, ryan cramer, miss saigon, perex + zden, thefreak, marwin and _garbage_obvious_rumourspreading_elk. + ( plus everyone i may forgot to mention... ) + + + ÜÛßßÛÜ from rdos + ÛÛßßÛÛ + ÛÛ ÛÛ lfatip, charon, jetman, fuckeer, tom, jap, perex, + rum, piitr, desmond, hachazo, deejay, bohunka, ludek, ivo, + some of his school mates plus contacts and kavon of course + + + ÛÛÜÜÛÛ from ondar + ÛÛÞÝÛÛ + ÛÛ ÛÛ y sister eva, dolphine, rum, mr.error, piitr + charon, perex, buusaci, jetman, kavon, desmond, hachazo + jana, fuckeer, pelusa, filip, alfatip, vasek, honza, + kaja, and vojta + + + ÛÛÜ ÛÛ from haberman + ÛÛßÛÛÛ + ÛÛ ÛÛ op + + + + t h a n k y o u + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + f o r b e i n g o u r s f o r a w h i l e . . + + + + + + + + + + + + + + + + + + + + + + +.10-29-96 \ No newline at end of file diff --git a/16/rac/FILE_ID.DIZ b/16/rac/FILE_ID.DIZ new file mode 100755 index 00000000..32e9ee51 --- /dev/null +++ b/16/rac/FILE_ID.DIZ @@ -0,0 +1,14 @@ +ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸ +³ D I M E N S I O N ³ +³ presents ³ +³ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄij +³ R A C ³ +³ version 0.01a ³ +³ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄij +³OPL2/3 music module grabber³ +³for your ears. FIRST generic³ +³adlib grabber in PC world at³ +³all. Coded in pure assembler.³ +³ Cooperates with RdosPlay. ³ +³ T R Y Y O U R S E L F.. ³ +ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; diff --git a/16/rac/RAC.DOC b/16/rac/RAC.DOC new file mode 100755 index 00000000..c04505b6 --- /dev/null +++ b/16/rac/RAC.DOC @@ -0,0 +1,202 @@ + ÂÂÄÄ¿ ÂÂÄÄ¿ ÚÂÄÄ¿ + ³³ ³ ³³ ³ ³³ + ³ÃÄÂÙ ³ÃÄÄ´ ³³ + ³³ À¿ ³³ ³ ³³ + ÀÙ À ÀÙ Á ÀÁÄÄÙ + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + + Written by Roman Dolejsi (RDOS / DIMENSION) + + December 31, 1996 + Last update: December 31, 1996 + + + This is the documentation belonging to and explaining the use of + + RAC version 0.01a + OPL2/OPL3 music module grabber for MS-DOS + + + TOPICS covered in this document: + + DISCLAIMER + APOLOGIZE + PURPOSE OF RAC + REQUIREMENTS + INSTALLATION OF RAC + RAC IN ACTION + DIALOG LINE + FREQUENTLY ASKED QUESTIONS + COPYRIGHT + WHERE TO FIND RAC + THANX + CONTACTING ME + + +DISCLAIMER: +----------- + Although RAC has been tested on several systems, I cannot guarantee that it +is bugless. Therefore I do not take responsibility for any damage directly or +indirectly caused by RAC as a result of known/unknown errors in it or errors +caused by its access to your devices. + + +APOLOGIZE: +---------- + Sorry, english is not my native language. However, I wrote this nice docy in +english without any help. I APOLOGIZE for any mistakes in the document. Take it +easy... Nobody is perfect.. :-) + + +PURPOSE OF RAC: +--------------- + Rdos Adlib Catcher is an OPL2/OPL3 music module grabber for IBM PC compatible +computers running MS-DOS operating system. This means that you can use it for +grabbing your favorite melody from some music player / demo or game. I've coded +it because of lack of any such grabber of this type in PC-world. + + +REQUIREMENTS: +------------- + RAC is coded in protected mode 386-assembler. For grabbing you will need 386 +or compatible computer without memory manager installed and adlib card. Grabbed +music can be replayed with RdosPlay (RDOS OPL Player). + + +INSTALLATION OF RAC: +-------------------- +- first you have to make some directory on your drive. Then you have to unpack + there archive file RACxyyz.ZIP. + (you probably did all this when you read these lines :-) + +- RAC pack should consist of these files: + + RAC.EXE - Main file - OPL grabber + RAC.DOC - Documentation for RAC (this file) + RAC.REV - RAC changes/revision history file + FILE_ID.DIZ - quick info file + +- now you have RAC successfully installed :-) + + +RAC IN ACTION: +-------------- + RAC can store all acesses to Adlib (OPL2) or some OPL3 card's I/O ports into +special file with RAW extension. That file can be later played with something +capable of playing that (hint: what about RdosPlay?). + After you start RAC, it initializes internal music buffer. Every access to +desired ports will be stored it that buffer. Therefore you have to run some +game, demo or player which uses adlib. When you later want to save buffer in +file or clear it you have to run RAC again with special parameter. + + +DIALOG LINE: +------------ +Dialog line looks as follows: + RAC.EXE [c] [s] + + possibilities: + c - clear music buffer + s - save music buffer into file RACDATA.RAW in this directory + + +RAW FILE SPECIFICATIONS: +------------------------ +RAW is originally founded probably by Future Crew demogroup which used it in +their BBS intro StarPort. RAW file generated by RAC is a derived version +which is also capable of OPL3 extension (ie. full four port access: 388-38Bh). +RAW files can be played with RdosPlay (look at Dimension homepage). + +format: [0]=db 'RAWADATA' ... file identifier + [8]=dw clock ... clock speed (like c-20) + [10]=dw data_size dup (data) ... adlib data + [..]=dw 0ffffh ... end of file +data: parameter, command. command==0: data==n ... wait n times. + command==2: data==0 ... set speed (next word) + command==2: data==1 ... set OPL3 port A default + command==2: data==2 ... set OPL3 port B default + + +FREQUENTLY ASKED QUESTIONS: +--------------------------- +* RAC does not want to run with PM driver (EMM386/QEMM/Win) installed. + - RAC uses clear 32-bit PM manager. It needs completely free environment + to operate. Therefore other PM managers will NEVER be supported. + What RAC uses is from the beginning meant as a complete memory manager + so it's internal functionality is absolutely incompatible with anything + other (even VCPI's ProtMode level 0). + +* Coprocessor seems not to be installed when RAC is running !! Why !?! + - I have to agree.. sorry for this.. still don't know why.. Maybe another + version... really sorry. + +* When I install RAC there is no EMS memory in system. Some of my programs + don't want to run at all. + - EMS services are not yet supported, sorry. Maybe another version.. + +* My application told me I have no VCPI compatible environment and refused + to run when I started it under RAC. +* My application refused to run with exit message about impossibility to enter + DPMI protected mode. + - VCPI/DPMI are 32-bit Protected mode interfaces allowing your applications + to run 32-bit code under other 32-bit PM environment installed in memory. + Although these ifaces are not yet supported, there exist light of hope + that DPMI will be supported some day. + +* How much system memory takes RAC for its work ? + - RAC takes about 1k of conventional mem. In fact, everything is in + Xmemory (above 1MB) and takes there about 550kB. But Xmemory requirements + probably don't bother anyone. + +* Programs tend to be slower under RAC. + - Yes, especially Adlib playing routines are slower, because PM exception + handling eats some of the system resources. + +* Are there any other known problems with RAC ? + - RAC counts waitstates via timer. When some music does not use timer for + playing (not such often case), RAC won't insert waitstates in generated + RAW file - file is not playable :-( Don't know any solution right now. + + +WHERE TO FIND RAC: +------------------ +Each time I have a new version of RAC available, I'll upload it to this place: + + ftp://sorry.vse.cz/dimension (Dimension FTP site in Prague, Czech Republic) + http://sorry.vse.cz/dimension (Dimension Inet HeadQuarters, Czech Republic) + +RAC will be probably also available at ftp.cdrom.com or ftp.sunet.se +FTP archives. + + Ask your local Internet or FTP expert on how to reach them. + +Another way is to visit RAC's homepage at address: + + http://sorry.vse.cz/dimension/rdos/rac (Http site in Prague, CZE) + + +THANX: +------ +Although I did all the programming, there is a friend which helped me: + +David Voracek (Assassin/Dimension) - idea, testing, suggestions + +and other friends for their (mostly) betatesting.. + + +CONTACTING ME: +-------------- + If you want to contact me, write to address listed below. If you want to send +me suggestions, tips or simply greets, send it freely. Also some money would be +good as a power and motivation for further work :-) + +My address: E-Mail: (non-commercial) + Roman Dolejsi (RDOS) roman@sorry.vse.cz + Husova 419, Vcelna roman@romeo.pf.jcu.cz + 37382 Ceske Budejovice + Czech Republic + +Please do not send me E-mails longer than 150kB (because of our local smtp +server limit). + +*** end of RAC documentation *** \ No newline at end of file diff --git a/16/rac/RAC.EXE b/16/rac/RAC.EXE new file mode 100755 index 00000000..b2ba22d5 Binary files /dev/null and b/16/rac/RAC.EXE differ diff --git a/16/rac/RAC.REV b/16/rac/RAC.REV new file mode 100755 index 00000000..c6d56042 --- /dev/null +++ b/16/rac/RAC.REV @@ -0,0 +1,3 @@ +RAC version 0.01a - 9th September 1996 +- initial revision (RPMMM ver 0.02: 1k ConvMemory, 550k Xmemory) + - no control keys \ No newline at end of file diff --git a/16/rac001a.zip b/16/rac001a.zip new file mode 100755 index 00000000..2958c145 Binary files /dev/null and b/16/rac001a.zip differ diff --git a/makefile b/makefile index 8a8bd909..b24edb2f 100755 --- a/makefile +++ b/makefile @@ -211,7 +211,6 @@ TESTEXEC = & 0tesuto.exe & maptest.exe & imfplay.exe & - i0fplay.exe & vrldbg.exe #zcroll.exe & TESTEXEC2 = & @@ -292,7 +291,6 @@ fontgfx.exe: fontgfx.$(OBJ) gfx.lib $(DOSLIB) inputest.exe: inputest.$(OBJ) $(16LIB) $(DOSLIB) gfx.lib sountest.exe: sountest.$(OBJ) $(16LIB) $(DOSLIB) gfx.lib imfplay.exe: imfplay.$(OBJ) $(16LIB) $(DOSLIB) gfx.lib -i0fplay.exe: i0fplay.$(OBJ) $(DOSLIB) vrldbg.exe: vrldbg.$(OBJ) #gfx.lib $(DOSLIB) pcxtest.exe: pcxtest.$(OBJ) gfx.lib $(DOSLIB) $(16LIB) vrstest.exe: vrstest.$(OBJ) $(16LIB) gfx.lib $(DOSLIB) @@ -343,7 +341,6 @@ inputest.$(OBJ):$(SRC)/inputest.c #inntest.$(OBJ):$(SRC)/inntest.c sountest.$(OBJ): $(SRC)/sountest.c imfplay.$(OBJ): $(SRC)/imfplay.c -i0fplay.$(OBJ): $(SRC)/i0fplay.c vrldbg.$(OBJ): $(SRC)/vrldbg.c #miditest.$(OBJ): $(SRC)/miditest.c #testemm.$(OBJ):$(SRC)/testemm.c diff --git a/src/i0fplay.c b/src/i0fplay.c deleted file mode 100755 index 0e67d2f1..00000000 --- a/src/i0fplay.c +++ /dev/null @@ -1,231 +0,0 @@ -/* midi.c - * - * Adlib OPL2/OPL3 FM synthesizer chipset test program. - * Play MIDI file using the OPLx synthesizer (well, poorly anyway) - * (C) 2010-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - * - * Compiles for intended target environments: - * - MS-DOS [pure DOS mode, or Windows or OS/2 DOS Box] - */ - -#include -#include /* this is where Open Watcom hides the outp() etc. functions */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include /* 8254 timer */ -#include -#include - -static void (interrupt *old_irq0)(); -static volatile unsigned long irq0_ticks=0; -static volatile unsigned int irq0_cnt=0,irq0_add=0,irq0_max=0; - -#pragma pack(push,1) -struct imf_entry { - uint8_t reg,data; - uint16_t delay; -}; -#pragma pack(pop) - -static struct imf_entry* imf_music=NULL; -static struct imf_entry* imf_play_ptr=NULL; -static struct imf_entry* imf_music_end=NULL; -static uint16_t imf_delay_countdown=0; - -void imf_free_music() { - if (imf_music) free(imf_music); - imf_music = imf_play_ptr = imf_music_end = NULL; - imf_delay_countdown = 0; -} - -int imf_load_music(const char *path) { - unsigned char buf[8]; - unsigned long len; - int fd; - - imf_free_music(); - - fd = open(path,O_RDONLY|O_BINARY); - if (fd < 0) return 0; - - len = lseek(fd,0,SEEK_END); - lseek(fd,0,SEEK_SET); - read(fd,buf,2); - if (buf[0] != 0 || buf[1] != 0) // type 1 IMF - len = *((uint16_t*)buf); - else - lseek(fd,0,SEEK_SET); - - if (len == 0 || len > 65535UL) { - close(fd); - return 0; - } - len -= len & 3; - - imf_music = malloc(len); - if (imf_music == NULL) { - close(fd); - return 0; - } - read(fd,imf_music,len); - close(fd); - - imf_play_ptr = imf_music; - imf_music_end = imf_music + (len >> 2UL); - return 1; -} - -/* WARNING: subroutine call in interrupt handler. make sure you compile with -zu flag for large/compact memory models */ -void interrupt irq0() { - irq0_ticks++; - if ((irq0_cnt += irq0_add) >= irq0_max) { - irq0_cnt -= irq0_max; - old_irq0(); - } - else { - p8259_OCW2(0,P8259_OCW2_NON_SPECIFIC_EOI); - } -} - -void imf_tick() { - if (imf_delay_countdown == 0) { - do { - adlib_write(imf_play_ptr->reg,imf_play_ptr->data); - imf_delay_countdown = imf_play_ptr->delay; - imf_play_ptr++; - if (imf_play_ptr == imf_music_end) - imf_play_ptr = imf_music; - } while (imf_delay_countdown == 0); - } - else { - imf_delay_countdown--; - } -} - -void adlib_shut_up() { - int i; - - memset(adlib_fm,0,sizeof(adlib_fm)); - memset(&adlib_reg_bd,0,sizeof(adlib_reg_bd)); - for (i=0;i < adlib_fm_voices;i++) { - struct adlib_fm_operator *f; - f = &adlib_fm[i].mod; - f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1; - f = &adlib_fm[i].car; - f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1; - } - - for (i=0;i < adlib_fm_voices;i++) { - struct adlib_fm_operator *f; - - f = &adlib_fm[i].mod; - f->mod_multiple = 1; - f->total_level = 63 - 16; - f->attack_rate = 15; - f->decay_rate = 4; - f->sustain_level = 0; - f->release_rate = 8; - f->f_number = 400; - f->sustain = 1; - f->octave = 4; - f->key_on = 0; - - f = &adlib_fm[i].car; - f->mod_multiple = 1; - f->total_level = 63 - 16; - f->attack_rate = 15; - f->decay_rate = 4; - f->sustain_level = 0; - f->release_rate = 8; - f->f_number = 0; - f->sustain = 1; - f->octave = 0; - f->key_on = 0; - } - - adlib_apply_all(); -} - -int main(int argc,char **argv) { - unsigned long tickrate = 700; - unsigned long ptick; - int c; - - printf("ADLIB FM test program IMFPLAY\n"); - if (argc < 2) { - printf("You must specify an IMF file to play\n"); - return 1; - } - - if (!init_adlib()) { - printf("Cannot init library\n"); - return 1; - } - if (!probe_8254()) { /* we need the timer to keep time with the music */ - printf("8254 timer not found\n"); - return 1; - } - - if (!imf_load_music(argv[1])) { - printf("Failed to load IMF Music\n"); - return 1; - } - - write_8254_system_timer(T8254_REF_CLOCK_HZ / tickrate); - irq0_cnt = 0; - irq0_add = 182; - irq0_max = 1000; /* about 18.2Hz */ - old_irq0 = _dos_getvect(8);/*IRQ0*/ - _dos_setvect(8,irq0); - - adlib_shut_up(); - shutdown_adlib_opl3(); // NTS: Apparently the music won't play otherwise - _cli(); - irq0_ticks = ptick = 0; - _sti(); - - while (1) { - unsigned long adv; - - _cli(); - adv = irq0_ticks - ptick; - if (adv >= 100UL) adv = 100UL; - ptick = irq0_ticks; - _sti(); - - while (adv != 0) { - imf_tick(); - adv--; - } - - if (kbhit()) { - c = getch(); - if (c == 0) c = getch() << 8; - - if (c == 27) { - break; - } - } - } - - imf_free_music(); - adlib_shut_up(); - shutdown_adlib(); - _dos_setvect(8,old_irq0); - write_8254_system_timer(0); /* back to normal 18.2Hz */ - return 0; -} - diff --git a/src/imfplay.c b/src/imfplay.c index be4c7766..563ab854 100755 --- a/src/imfplay.c +++ b/src/imfplay.c @@ -21,174 +21,11 @@ #include "src/lib/16_dbg.h" #include "src/lib/16_sd.h" -// #include -// #include /* this is where Open Watcom hides the outp() etc. functions */ -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include - extern struct glob_game_vars *ggvv; -static void (interrupt *old_irq0)(); -/*static volatile unsigned long irq0_ticks=0; -static volatile unsigned int irq0_cnt=0,irq0_add=0,irq0_max=0; - -#pragma pack(push,1) -struct imf_entry { - uint8_t reg,data; - uint16_t delay; -}; -#pragma pack(pop) - -static struct imf_entry* imf_music=NULL; -static struct imf_entry* imf_play_ptr=NULL; -static struct imf_entry* imf_music_end=NULL; -static uint16_t imf_delay_countdown=0; - -#define PRINTBB {\ - printf("-------------------------------------------------------------------------------\n");\ - printf("buffer:\n");\ - printf("bigbuffer %Fp\t", gvar->ca.audiosegs[0]);\ - printf("&%Fp\n", MEMPTR gvar->ca.audiosegs[0]);\ - printf("imf_music %Fp\t", imf_music);\ - printf("&%Fp\n", imf_music);\ - printf("imf_play_ptr %Fp\t", imf_play_ptr);\ - printf("&%Fp\n", imf_play_ptr);\ - printf("imf_music_end %Fp\t", imf_music_end);\ - printf("&%Fp\n", imf_music_end);\ - printf("-------------------------------------------------------------------------------\n");\ -} - -void imf_free_music(global_game_variables_t *gvar) { - if (gvar->ca.sd.imf_music) free(gvar->ca.sd.imf_music); - MM_FreePtr(MEMPTRCONV gvar->ca.audiosegs[0], gvar); - gvar->ca.sd.imf_music = gvar->ca.sd.imf_play_ptr = gvar->ca.sd.imf_music_end = NULL; - gvar->ca.sd.imf_delay_countdown = 0; -} - -int imf_load_music(const char *path, global_game_variables_t *gvar) { - unsigned long len; - unsigned char buf[8]; - int fd; - - imf_free_music(gvar); - - fd = open(path,O_RDONLY|O_BINARY); - if (fd < 0) return 0; - - len = lseek(fd,0,SEEK_END); - lseek(fd,0,SEEK_SET); - read(fd,buf,2); - if (buf[0] != 0 || buf[1] != 0) // type 1 IMF - len = *((uint16_t*)buf); - else - lseek(fd,0,SEEK_SET); - - if (len == 0 || len > 65535UL) { - close(fd); - return 0; - } - len -= len & 3; - -// imf_music = malloc(len); - MM_GetPtr(MEMPTRCONV gvar->ca.audiosegs[0],len, gvar); - gvar->ca.sd.imf_music = (struct imf_entry *)gvar->ca.audiosegs[0]; - if (gvar->ca.sd.imf_music == NULL) { - close(fd); - return 0; - } - read(fd,gvar->ca.sd.imf_music,len); - close(fd); - - gvar->ca.sd.imf_play_ptr = gvar->ca.sd.imf_music; - gvar->ca.sd.imf_music_end = gvar->ca.sd.imf_music + (len >> 2UL); -// PRINTBB; - return 1; -}*/ - -// WARNING: subroutine call in interrupt handler. make sure you compile with -zu flag for large/compact memory models -void interrupt irq0() -{ - ggvv->ca.sd.irq0_ticks++; - if ((ggvv->ca.sd.irq0_cnt += ggvv->ca.sd.irq0_add) >= ggvv->ca.sd.irq0_max) { - ggvv->ca.sd.irq0_cnt -= ggvv->ca.sd.irq0_max; - old_irq0(); - } - else { - p8259_OCW2(0,P8259_OCW2_NON_SPECIFIC_EOI); - } -} - -/*void imf_tick() { - if (imf_delay_countdown == 0) { - do { - adlib_write(imf_play_ptr->reg,imf_play_ptr->data); - imf_delay_countdown = imf_play_ptr->delay; - imf_play_ptr++; - if (imf_play_ptr == imf_music_end) - { - printf("replay\n"); - imf_play_ptr = imf_music; - } - } while (imf_delay_countdown == 0); - } - else { - imf_delay_countdown--; - } -} - -void adlib_shut_up() { - int i; - - memset(adlib_fm,0,sizeof(adlib_fm)); - memset(&adlib_reg_bd,0,sizeof(adlib_reg_bd)); - for (i=0;i < adlib_fm_voices;i++) { - struct adlib_fm_operator *f; - f = &adlib_fm[i].mod; - f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1; - f = &adlib_fm[i].car; - f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1; - } - - for (i=0;i < adlib_fm_voices;i++) { - struct adlib_fm_operator *f; - - f = &adlib_fm[i].mod; - f->mod_multiple = 1; - f->total_level = 63 - 16; - f->attack_rate = 15; - f->decay_rate = 4; - f->sustain_level = 0; - f->release_rate = 8; - f->f_number = 400; - f->sustain = 1; - f->octave = 4; - f->key_on = 0; - - f = &adlib_fm[i].car; - f->mod_multiple = 1; - f->total_level = 63 - 16; - f->attack_rate = 15; - f->decay_rate = 4; - f->sustain_level = 0; - f->release_rate = 8; - f->f_number = 0; - f->sustain = 1; - f->octave = 0; - f->key_on = 0; - } - - adlib_apply_all(); -}*/ - void main(int argc,char **argv) { static global_game_variables_t gvar; - unsigned long ptick, tickrate = 700; + unsigned long adv; int c; #ifdef __DEBUG_CA__ dbg_debugca=1; @@ -211,22 +48,14 @@ void main(int argc,char **argv) { return; } - write_8254_system_timer(T8254_REF_CLOCK_HZ / tickrate); - old_irq0 = _dos_getvect(8); /*IRQ0*/ - _dos_setvect(8,irq0); - - _cli(); - gvar.ca.sd.irq0_ticks = ptick = 0; - _sti(); + SD_StartupTimer(&gvar); printf("playing!\n"); while (1) { - unsigned long adv; - _cli(); - adv = gvar.ca.sd.irq0_ticks - ptick; + adv = gvar.ca.sd.irq0_ticks - gvar.ca.sd.ptick; if (adv >= 100UL) adv = 100UL; - ptick = gvar.ca.sd.irq0_ticks; + gvar.ca.sd.ptick = gvar.ca.sd.irq0_ticks; _sti(); while (adv != 0) { @@ -248,7 +77,7 @@ void main(int argc,char **argv) { SD_imf_free_music(&gvar); SD_adlib_shut_up(); shutdown_adlib(); - _dos_setvect(8,old_irq0); + SD_ShutdownTimer(); write_8254_system_timer(0); /* back to normal 18.2Hz */ ShutdownCAMMPM(&gvar); } diff --git a/src/lib/.16_sd.h.kate-swp b/src/lib/.16_sd.h.kate-swp new file mode 100755 index 00000000..5680e707 Binary files /dev/null and b/src/lib/.16_sd.h.kate-swp differ diff --git a/src/lib/16_sd.c b/src/lib/16_sd.c index b3349bc2..1cdd5627 100755 --- a/src/lib/16_sd.c +++ b/src/lib/16_sd.c @@ -22,8 +22,7 @@ #include "src/lib/16_sd.h" -static void (interrupt *SD_old_irq0)(); -//void interrupt (*old_irq0)(void); +static void interrupt (*t0OldService)(void); void opl2out(word reg, word data) { @@ -196,6 +195,24 @@ void FMSetVoice(int voiceNum, FMInstrument *ins){ opl2out(opCellNum, ins->Feedback); } /* End of FMSetVoice */ + +//newer sd + + +struct glob_game_vars *ggvv; +// WARNING: subroutine call in interrupt handler. make sure you compile with -zu flag for large/compact memory models +void interrupt SDL_irq0() +{ + ggvv->ca.sd.irq0_ticks++; + if ((ggvv->ca.sd.irq0_cnt += ggvv->ca.sd.irq0_add) >= ggvv->ca.sd.irq0_max) { + ggvv->ca.sd.irq0_cnt -= ggvv->ca.sd.irq0_max; + t0OldService(); + } + else { + p8259_OCW2(0,P8259_OCW2_NON_SPECIFIC_EOI); + } +} + void SD_Initimf(global_game_variables_t *gvar) { if (!init_adlib()) { @@ -207,17 +224,10 @@ void SD_Initimf(global_game_variables_t *gvar) return; } - gvar->ca.sd.irq0_ticks= - //gvar->ca.sd.irq0_cnt= - //gvar->ca.sd.irq0_add= - gvar->ca.sd.imf_delay_countdown= - gvar->ca.sd.irq0_max=0; + gvar->ca.sd.imf_delay_countdown=0; gvar->ca.sd.imf_music= gvar->ca.sd.imf_play_ptr= gvar->ca.sd.imf_music_end=NULL; - gvar->ca.sd.irq0_cnt = 0; - gvar->ca.sd.irq0_add = 182; - gvar->ca.sd.irq0_max = 1000; /* about 18.2Hz */ SD_adlib_shut_up(); shutdown_adlib_opl3(); // NTS: Apparently the music won't play otherwise @@ -229,6 +239,28 @@ void SD_imf_reset_music(global_game_variables_t *gvar) gvar->ca.sd.imf_delay_countdown = 0; } +void SD_StartupTimer(global_game_variables_t *gvar) +{ + gvar->ca.sd.irq0_ticks= + gvar->ca.sd.irq0_cnt = 0; + gvar->ca.sd.irq0_add = 182; + gvar->ca.sd.irq0_max = 1000; /* about 18.2Hz */ + gvar->ca.sd.tickrate = 700; + + write_8254_system_timer(T8254_REF_CLOCK_HZ / gvar->ca.sd.tickrate); + t0OldService = _dos_getvect(8); /*IRQ0*/ + _dos_setvect(8,SDL_irq0); + + _cli(); + gvar->ca.sd.irq0_ticks = gvar->ca.sd.ptick = 0; + _sti(); +} + +void SD_ShutdownTimer() +{ + _dos_setvect(8,t0OldService); +} + void SD_imf_free_music(global_game_variables_t *gvar) { #ifndef SD_USESCAMMPM @@ -286,20 +318,6 @@ int SD_imf_load_music(const char *path, global_game_variables_t *gvar) return 1; } -struct glob_game_vars *ggvv; -// WARNING: subroutine call in interrupt handler. make sure you compile with -zu flag for large/compact memory models -void interrupt SD_irq0() -{ - ggvv->ca.sd.irq0_ticks++; - if ((ggvv->ca.sd.irq0_cnt += ggvv->ca.sd.irq0_add) >= ggvv->ca.sd.irq0_max) { - ggvv->ca.sd.irq0_cnt -= ggvv->ca.sd.irq0_max; - SD_old_irq0(); - } - else { - p8259_OCW2(0,P8259_OCW2_NON_SPECIFIC_EOI); - } -} - void SD_imf_tick(global_game_variables_t *gvar) { if (gvar->ca.sd.imf_delay_countdown == 0) { diff --git a/src/lib/16_sd.h b/src/lib/16_sd.h index 117ab0c4..73600a11 100755 --- a/src/lib/16_sd.h +++ b/src/lib/16_sd.h @@ -67,6 +67,8 @@ void FMSetVoice(int voiceNum, FMInstrument *ins); void SD_Initimf(global_game_variables_t *gvar); void SD_imf_reset_music(global_game_variables_t *gvar); +void SD_StartupTimer(global_game_variables_t *gvar), + SD_ShutdownTimer(); void SD_imf_free_music(global_game_variables_t *gvar); int SD_imf_load_music(const char *path, global_game_variables_t *gvar); void interrupt SD_irq0(void); diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 0016fcee..9b1bebd6 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -667,6 +667,7 @@ typedef struct imf_entry_t* imf_play_ptr;//=NULL; imf_entry_t* imf_music_end;//=NULL; word imf_delay_countdown;//=0; + dword ptick,tickrate; } sd_t; //========================================================================== diff --git a/src/util/z.sh b/src/util/z.sh index 7561110a..d316bd53 100755 --- a/src/util/z.sh +++ b/src/util/z.sh @@ -1,7 +1,7 @@ #!/bin/bash while [ -n "$1" ] do - 7z a -v64k -r /var/www/"$1".zip "$1" - echo 7z a -v64k -r /var/www/"$1".zip "$1" + 7z a -v64k /var/www/"$1".zip "$1" + echo 7z a -v64k /var/www/"$1".zip "$1" shift done