X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fimfplay.c;h=697b6d3611e7f3d7940223948a5f91b58b0756a4;hb=28b1be191222717943878f024cddac30b026318e;hp=3aefa2d2e8f47008378ed33693798f96911ec70c;hpb=b0e52bf89f50997ba85d95c748f00dbf386f7fae;p=16.git diff --git a/src/imfplay.c b/src/imfplay.c index 3aefa2d2..697b6d36 100755 --- a/src/imfplay.c +++ b/src/imfplay.c @@ -31,9 +31,9 @@ // #include // #include // #include -struct glob_game_vars *ggvv; -static void (interrupt *old_irq0)(); +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; @@ -110,7 +110,7 @@ int imf_load_music(const char *path, global_game_variables_t *gvar) { PRINTBB; return 1; } -*/ + // WARNING: subroutine call in interrupt handler. make sure you compile with -zu flag for large/compact memory models void interrupt irq0() { @@ -123,7 +123,7 @@ void interrupt irq0() p8259_OCW2(0,P8259_OCW2_NON_SPECIFIC_EOI); } } -/* + void imf_tick() { if (imf_delay_countdown == 0) { do { @@ -188,8 +188,7 @@ void adlib_shut_up() { void main(int argc,char **argv) { static global_game_variables_t gvar; - unsigned long tickrate = 700; - unsigned long ptick; + unsigned long ptick, tickrate = 700; int c; #ifdef __DEBUG_CA__ dbg_debugca=1; @@ -198,38 +197,24 @@ void main(int argc,char **argv) { dbg_debugmm=1; #endif ggvv=&gvar; - MM_Startup(&gvar); - PM_Startup(&gvar); PM_CheckMainMem(&gvar); PM_UnlockMainMem(&gvar); - CA_Startup(&gvar); + StartupCAMMPM(&gvar); printf("ADLIB FM test program IMFPLAY\n"); if (argc < 2) { printf("You must specify an IMF file to play\n"); - return; +// return; } - if (!init_adlib()) { - printf("Cannot init library\n"); - return; - } - if (!probe_8254()) { /* we need the timer to keep time with the music */ - printf("8254 timer not found\n"); - return; - } + SD_Initimf(&gvar); if (!SD_imf_load_music(argv[1], &gvar)) { printf("Failed to load IMF Music\n"); - return; +// return; } write_8254_system_timer(T8254_REF_CLOCK_HZ / tickrate); - gvar.ca.sd.irq0_cnt = 0; - gvar.ca.sd.irq0_add = 182; - gvar.ca.sd.irq0_max = 1000; /* about 18.2Hz */ - old_irq0 = _dos_getvect(8);/*IRQ0*/ + old_irq0 = _dos_getvect(8); /*IRQ0*/ _dos_setvect(8,irq0); - SD_adlib_shut_up(); - shutdown_adlib_opl3(); // NTS: Apparently the music won't play otherwise _cli(); gvar.ca.sd.irq0_ticks = ptick = 0; _sti(); @@ -263,8 +248,6 @@ void main(int argc,char **argv) { SD_adlib_shut_up(); shutdown_adlib(); _dos_setvect(8,old_irq0); - write_8254_system_timer(0);/* back to normal 18.2Hz */ - PM_Shutdown(&gvar); - CA_Shutdown(&gvar); - MM_Shutdown(&gvar); + write_8254_system_timer(0); /* back to normal 18.2Hz */ + ShutdownCAMMPM(&gvar); }