#include "src/lib/16_timer.h"\r
#include "src/lib/16render.h"\r
#include "src/lib/16_dbg.h"\r
+#include "src/lib/16_sd.h"\r
\r
#define FADE\r
//#define NOMAPLOAD\r
//extern boolean pageflipflop=1;\r
extern boolean pagenorendermap; //default: 0\r
unsigned int i;\r
+struct glob_game_vars *ggvv;\r
\r
#ifdef FADE\r
//static word paloffset=0;\r
#define FILENAME_2 "data/spri/me.vrs"\r
#define FILENAME_2P "data/spri/me.pal"\r
\r
+static void (interrupt *old_irq0)();\r
+// WARNING: subroutine call in interrupt handler. make sure you compile with -zu flag for large/compact memory models\r
+void interrupt irq0()\r
+{\r
+ ggvv->ca.sd.irq0_ticks++;\r
+ if ((ggvv->ca.sd.irq0_cnt += ggvv->ca.sd.irq0_add) >= ggvv->ca.sd.irq0_max) {\r
+ ggvv->ca.sd.irq0_cnt -= ggvv->ca.sd.irq0_max;\r
+ old_irq0();\r
+ }\r
+ else {\r
+ p8259_OCW2(0,P8259_OCW2_NON_SPECIFIC_EOI);\r
+ }\r
+}\r
+\r
void main(int argc, char *argv[])\r
{\r
static global_game_variables_t gvar;\r
- struct glob_game_vars *ggvv;\r
+ unsigned long tickrate = 700;\r
+ unsigned long ptick;\r
+ unsigned long adv;\r
// sword bakapee;\r
// if(argv[1]) bakapee = atoi(argv[1]);\r
// else bakapee = 1;\r
char bakapee1p[64] = FILENAME_1P;\r
\r
Startup16(&gvar);\r
+ if (!SD_imf_load_music("data/02.imf", &gvar)){ printf("Failed to load IMF Music\n"); return; }\r
\r
// bakapee1=mALLoc(64);\r
// bakapee1p=mALLoc(64);\r
\r
// create the map\r
// fprintf(stderr, "testing map load~ ");\r
+\r
CA_loadmap("data/test.map", &map, &gvar);\r
#ifndef NOMAPLOAD\r
chkmap(&map, 0);\r
// setup camera and screen~\r
modexHiganbanaPageSetup(&gvar);\r
ZC_MVSetup(&gvar.mv, &map, &gvar);\r
-\r
+/*\r
#ifdef FADE\r
modexFadeOn(4, &gvar.video.palette);\r
#endif\r
-\r
- IN_StartAck (&gvar);\r
- MM_ShowMemory(&gvar);\r
- while (!IN_CheckAck (&gvar)){}\r
+ IN_StartAck (&gvar); MM_ShowMemory(&gvar); while (!IN_CheckAck (&gvar)){}\r
#ifdef FADE\r
modexPalBlack(); //so player will not see loadings~\r
#endif\r
-\r
+*/\r
// set up paging\r
//TODO: LOAD map data and position the map in the middle of the screen if smaller then screen\r
mapGoTo(&gvar.mv, 0, 0);\r
ZC_PlayerXYpos(0, 0, &gvar.player, &gvar.mv, 0, 1);\r
EN_initPlayer(&gvar.player[0], &gvar.video);\r
//print_anim_ids(gvar.player[0].enti.spri);\r
+ SD_Initimf(&gvar);\r
+\r
+ write_8254_system_timer(T8254_REF_CLOCK_HZ / tickrate);\r
+ old_irq0 = _dos_getvect(8);/*IRQ0*/\r
+ _dos_setvect(8,irq0);\r
+\r
+// _cli();\r
+ gvar.ca.sd.irq0_ticks = ptick = 0;\r
+// _sti();\r
if (gvar.video.sprifilei == -1)\r
{\r
#ifdef FADE\r
#endif\r
while(!gvar.in.inst->Keyboard[sc_Escape] && gvar.player[0].enti.hp>0)\r
{\r
+// _cli();\r
+ adv = gvar.ca.sd.irq0_ticks - ptick;\r
+ if (adv >= 100UL) adv = 100UL;\r
+ ptick = gvar.ca.sd.irq0_ticks;\r
+// _sti();\r
+ while (adv != 0) {\r
+ SD_imf_tick(&gvar);\r
+ adv--;\r
+ }\r
gvar.video.page[0].tlx=gvar.mv[0].tx*TILEWH;\r
gvar.video.page[0].tly=gvar.mv[0].ty*TILEWH;\r
shinku(&gvar);\r
modexSavePalFile("data/g.pal", &gvar.video.palette);\r
modexFadeOff(4, &gvar.video.palette);\r
#endif\r
+ SD_imf_free_music(&gvar);\r
+ SD_adlib_shut_up();\r
+ shutdown_adlib();\r
+ _dos_setvect(8,old_irq0);\r
+ write_8254_system_timer(0);/* back to normal 18.2Hz */\r
Shutdown16(&gvar);\r
printf("\nProject 16 xcroll.exe. This is just a test file!\n");\r
printf("version %s\n", VERSION);\r