int main(void) { volatile float fnk1,fnk2,fnk3=0; int i; Set_System(); SysTickInit(INTERVAL); conio_init(UART_DEFAULT_NUM,UART_BAUDLATE); printf("\n"); printf("Welcome to %s test program !!\n",MPU_SUBMODEL); printf("Version %s!!\n",APP_VERSION); printf("Build Date : %s\n",__DATE__); fnk1 = 14.0; fnk2 = 9.0; fnk3 = fnk1/fnk2; printf("Floating point calculation: %f/%f=%f\n",fnk1,fnk2,fnk3); printf("\n"); fnk1 = 0.0; for (i = 1;i < 50000000;i += 4) { fnk1 += 4.0f / (float)(i) - 4.0f / (float)(i + 2); } printf("pi: %f\n",fnk1); printf("\n"); /* Main Loop */ while (1) { _delay_ms(100); _delay_ms(100); } }
int main(void) { /* Set Basis System(includes SYSTICK Setings) */ Set_System(); /* Set UART and redirect to stdio */ conio_init(UART_DEFAULT_NUM,UART_BAUDRATE); BSP_LED_Init(LED_GREEN); int i = 0; for(;;) { BSP_LED_Toggle(LED_GREEN); for (int j = 0; j < 1000000; j++) ; printf("Hello, world! -- %i\n", i++); } return 0; }
int main(int argc, char **argv) { pvr_init_defaults(); printf("kosh starting\n"); /* initialize the conio service */ conio_init(CONIO_TTY_PVR, CONIO_INPUT_LINE); // conio_init(CONIO_TTY_SERIAL, CONIO_INPUT_LINE); /* initialize kosh */ kosh_init(); /* Add a test builtin */ kosh_builtin_add("test", "This is a test command.", test_builtin); /* wait for the user to exit */ kosh_join(); /* shutdown kosh */ kosh_shutdown(); /* shutdown console i/o */ conio_shutdown(); printf("kosh is done\n"); return 0; }
void do_client() { char obuffer[1024] = {0}, ibuffer[1024] = {0}; int obuffer_offset = 0, stop = 0; fflush (stdout); /* get anything out of the buffer */ conio_init(); show_buffer (obuffer, obuffer_offset); do { if (net_query (chan)) { int col = 10; int x = net_receive (chan, ibuffer, 1024, NULL); if (x<0) strcpy (ibuffer, "!!! (local) error reading packet"); else ibuffer[x] = 0; switch (ibuffer[0]) { case '*': col = 9; break; case '+': case '-': col = 11; break; case '!': col = 12; break; } write_to_window (ibuffer, col); show_buffer (obuffer, obuffer_offset); if (!strcmp (ibuffer, "*** go away")) stop = 1; if (!strcmp (ibuffer, "*** server shutting down")) stop = 1; } if (conio_kbhit()) { char ch = conio_getch(); switch (ch) { case 7: case 8: if (obuffer_offset) obuffer[--obuffer_offset] = 0; show_buffer (obuffer, obuffer_offset); break; case 13: net_send (chan, obuffer, strlen (obuffer)); obuffer[obuffer_offset = 0] = 0; show_buffer (obuffer, obuffer_offset); break; default: obuffer[obuffer_offset] = ch; obuffer[++obuffer_offset] = 0; show_buffer (obuffer, obuffer_offset); break; } } } while (!stop); erase_buffer(); conio_exit(); }
int main(int argc,char* argv[]) { dj_vm * vm; dj_object * obj; conio_init(); // initialise timer dj_timer_init(); initLed(); // initialise memory manager dj_mem_init(mem, HEAPSIZE); // Create a new VM vm = dj_vm_create(); // tell the execution engine to use the newly created VM instance dj_exec_setVM(vm); dj_named_native_handler handlers[] = { { "base", &base_native_handler }, { "darjeeling2", &darjeeling2_native_handler }, }; int length = sizeof(handlers)/ sizeof(handlers[0]); dj_archive archive; archive.start = (dj_di_pointer)di_archive_data; archive.end = (dj_di_pointer)di_archive_data_end; dj_vm_loadInfusionArchive(vm, &archive, handlers, length); // pre-allocate an OutOfMemoryError object obj = dj_vm_createSysLibObject(vm, BASE_CDEF_java_lang_OutOfMemoryError); dj_mem_setPanicExceptionObject(obj); // start the main execution loop while (dj_vm_countLiveThreads(vm)>0) { dj_vm_schedule(vm); if (vm->currentThread!=NULL) if (vm->currentThread->status==THREADSTATUS_RUNNING) dj_exec_run(RUNSIZE); } dj_vm_schedule(vm); dj_mem_gc(); dj_vm_destroy(vm); conio_shutdown(); return 0; }
int main (void) { char str[20]; char *p; #ifdef unix conio_init(); #endif /* read 17 chars, and a null terminator */ str[0] = 18; /* Read a string at the end of a line */ clrscr(); gotoxy (78, 1); cputs ("This text should wrap"); gotoxy (1, 5); cputs ("Enter a string:"); gotoxy (1, 6); p = cgets (str); gotoxy (1, 19); cputs (p); gotoxy (1, 20); cputs ("Press any key to quit"); getch(); clrscr(); #ifdef unix conio_end(); #endif /* Print some results */ printf ("%s = %d chars\n", p, strlen(p)); printf ("str[0] = %d\n", str[0]); printf ("str[1] = %d\n", str[1]); exit (0); }
/* get all our abi's and then start our main loop */ int main(int argc, char **argv) { pvr_init_defaults(); printf("kosh starting\n"); /* initalize the conio service */ //conio_init(CONIO_TTY_PVR, CONIO_INPUT_LINE); conio_init(CONIO_TTY_SERIAL, CONIO_INPUT_LINE); conio_printf(" **** KOSH v1.4, The KallistiOS Shell ****\n"); /* change directory to the default */ chdir("/"); /* this is the meat */ while (!kosh_exit) input_oneloop(); /* shutdown console i/o */ conio_shutdown(); printf("kosh is done\n"); return 0; }
int32_t main(void){ gain g = { 0.0, 0.0, 0.0}; uint32_t index = 0; int32_t size; uint8_t data_rx[64]; uint8_t data_tx = 0x00; uint32_t start, end; //初期化開始 conio_init(57600UL); Init_timer(); InitLED(); rcin_enable(0); Init_i2c(); Init_fram(); Init_DT(); printf("Initialize OK.\r\n"); //初期化終了 i2c->Cfg.SlaveAddr = 0x42; i2c->Cfg.BaudRate = 400000; g.p_gain = read_float(0); g.i_gain = read_float(4); g.d_gain = read_float(8); printf("%f, %f, %f\r\n", g.p_gain, g.i_gain, g.d_gain); while(1){ } }
/*-----------------------------------------------------------------------------------*/ int main(int argc, char **argv) { /* irqload_init();*/ #ifdef WITH_UIP uip_init(); uip_main_init(); resolv_init(); #ifdef WITH_TFE cs8900a_init(); #endif /* WITH_TFE */ #ifdef WITH_RS232 rs232dev_init(); #endif /* WITH_RS232 */ #ifdef WITH_TAPDEV tapdev_init(); #endif /* WITH_TAPDEV */ #endif /* WITH_UIP */ conio_init(); textcolor(1);bgcolor(0); clrscr(); conio_update(); //joy_load_driver(joy_stddrv); #if 0 { int i,j; clrscr(); textcolor(0);bgcolor(1); while(1) { gotoxy(0,0); cprintf("%d\n",i++); conio_update(); if(kbhit()) { cprintf(" "); cprintf("%02x",cgetc()); cprintf("\n"); } else { cprintf("pressed: ---------\n"); } j=joy_read(0); cprintf("%08x\n",j); } } #endif ek_init(); dispatcher_init(); ctk_init(); contiki_init(); programs_init(); ctk_redraw(); ek_run(); clrscr(); return 0; argv = argv; argc = argc; }
int main(void) { UINT n = 0; GPIO_InitTypeDef GPIO_InitStructure; /* FF用のPB14の設定 */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE); GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOB, &GPIO_InitStructure); /* RWD用のPB13の設定 */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOB, &GPIO_InitStructure); /* HOLD用のPB12の設定 */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOB, &GPIO_InitStructure); /* FN1242 DAC コントロール用のPC4-6の設定 */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 |GPIO_Pin_5 |GPIO_Pin_6; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_ResetBits(GPIOC,GPIO_Pin_4 | GPIO_Pin_5); // MC <= 0 MD <= 0 GPIO_SetBits(GPIOC,GPIO_Pin_6); // ML <= 1 #ifdef USE_USART conio_init(UART_DEFAULT_NUM,UART_BAUDLATE); #ifdef USE_PRINTF printf("\n"); printf("Welcome to %s test program !!\n",MPU_SUBMODEL); printf("Version %s!!\n",APP_VERSION); printf("Build Date : %s\n",__DATE__); #else cputs("\r\n"); cputs("Welcome to"); cputs(MPU_SUBMODEL); cputs("test program !!\r\n"); cputs("Version"); cputs(APP_VERSION); cputs("!!\r\n"); cputs("Build Date : "); cputs(__DATE__); cputs("\r\n"); #endif #endif /* ADCの初期化 */ initADC(); /* I2Sポートの初期化*/ initI2S(); /* I2Sポートをスタート */ startI2S(44100,16); /* IRQの設定とDMAのイネーブル */ setIRQandDMA(); if ((!initSD()) && (lsSD() == FR_OK)) { while (Command_index != 3) { sdio_playNO(n); if ((Command_index == 0) || (Command_index == 1)) { n++; if (n >= sMUSIC) { n = 0; } } else if (Command_index == 2){ if (n == 0) { if (sMUSIC > 0) { n = sMUSIC - 1; } else { n = 0; } } else { n--; } } } } while(1) { } #ifndef NO_ADC #ifdef USE_PRINTF printf("Low Voltage Stop\n"); #endif PWR_EnterSTANDBYMode(); #endif while(1) { } }
int main (int argc, char *argv[]) { /* These have been moved from global to local variables */ /* this reduces binary size and improves code structure. RP */ /* Also size of home_page and help_page reduced from 257. RP 11-mar-04 */ char home_page[20] = "index.htm"; char help_page[20] = "help.htm"; char base_dir[257]; char *showcommand = 0; char *oldscreen; int oldcursorx = wherex (), oldcursory = wherey (); int i; /* counter for loop */ int forcemono = 0, fancyscheme = 0; int AsciiExtendedChars = 1; int codepage = 0; cat = catopen("htmlhelp", 0); if (getenv ("HELPPATH") == NULL) { get_base_dir (base_dir, argv[0]); strcat (base_dir, "..\\help\\"); /* default location */ if (lang_add(base_dir, home_page) != 0) { char testpath[257]; get_base_dir (base_dir, argv[0]); strcat (base_dir, "..\\help\\"); /* bookshelf location */ strcpy(testpath, base_dir); strcat(testpath, home_page); if (checkForFile(testpath) != 0) { get_base_dir (base_dir, argv[0]); /* try same dir as exe */ strcpy(testpath, base_dir); strcat(testpath, home_page); if (checkForFile(testpath) != 0) { *base_dir = '\0'; /* try current dir */ strcpy(testpath, home_page); if (checkForFile(testpath) != 0) { get_base_dir (base_dir, argv[0]); strcat (base_dir, "..\\help\\"); } } } } } else { strcpy (base_dir, getenv ("HELPPATH")); if (lang_add(base_dir, home_page) != 0) { strcpy (base_dir, getenv ("HELPPATH")); if (base_dir[0] != '\0') { if (base_dir[strlen(base_dir)-1] != '\\' && base_dir[strlen(base_dir)-1] != '/'); strcat (base_dir, "\\"); } } } if (getenv ("HELPCMD")) { if (strstr (getenv ("HELPCMD"), "/A")) AsciiExtendedChars = 0; if (strstr (getenv ("HELPCMD"), "/M")) forcemono = 1; if (strstr (getenv ("HELPCMD"), "/F1")) fancyscheme = 1; if (strstr (getenv ("HELPCMD"), "/F2")) fancyscheme = 2; } for (i = 1; i < argc; i++) { if (argv[i][0] == '/') { switch (argv[i][1]) { default: printf ("%s -- %s\n", hcatInvArg, argv[i] + 1); printf ("%s\n", hcatHowGetUsage); break; case '?': show_usage (); return 0; case 'a': case 'A': if (argv[i][2] == 0) AsciiExtendedChars = 0; break; case 'c': case 'C': codepage = atoi(argv[i]+2); if (codepage == 0) { printf("%s (/Cnnn)\n", hcatCodepagePlease); printf("%s:\n%s\n", hcatCodepagesSupported, supportedCodepages); return 0; } break; case 'f': case 'F': fancyscheme = atoi(argv[i] + 2); if (fancyscheme < 1 || fancyscheme > 2) fancyscheme = 1; break; case 'h': case 'H': if (argv[i][2] == 0) /* Only put /h or /H */ { printf ("%s\n", hcatInvArg); printf ("%s\n", hcatHowGetUsage); return 0; } else { strncpy(help_page, argv[i] + 2, 14); } break; case 'l': case 'L': strcat (base_dir, argv[i] + 2); checkForFile (base_dir); get_home_page (home_page, base_dir); get_base_dir (base_dir, base_dir); break; case 'm': case 'M': if (argv[i][2] == '\0') forcemono = 1; else { printf ("%s -- %s\n", hcatInvArg, argv[i] + 1); printf ("%s\n", hcatHowGetUsage); return 0; } break; case 'o': /* Override index file path/name */ case 'O': strcpy (base_dir, argv[i] + 2); if (lang_add(base_dir, home_page) != 0) { strcpy (base_dir, argv[i] + 2); checkForFile (base_dir); get_home_page (home_page, base_dir); get_base_dir (base_dir, base_dir); } } } else if (showcommand == 0) { showcommand = malloc (strlen (argv[i]) + 11); if (!showcommand) { printf ("%s\n", hcatMemErr); return 0; } sprintf (showcommand, "#%s", argv[i]); } else { printf ("%s\n", hcat2ManyTopics); printf ("%s\n", hcatHowGetUsage); return 0; } } if (fancyscheme && forcemono) { printf ("%s\n", hcatFwithN); printf ("%s\n", hcatHowGetUsage); return 0; } /* detect (or force) the codepage to select UTF-8 and entity substition support */ if (selectCodepage(codepage) != codepage && codepage > 0) { printf("%s\n", hcatCodepageNotSupported); printf("%s:\n%s\n", hcatCodepagesSupported, supportedCodepages); return 0; } /* initialise user interface */ conio_init (forcemono); if (forcemono == 0) { oldscreen = malloc (W * H * 2); if (oldscreen) save_window (X, Y, W, H, oldscreen); } if (MonoOrColor == COLOR_MODE && fancyscheme == 0) { TEXT_COLOR = C_TEXT_COLOR; BOLD_COLOR = C_BOLD_COLOR; ITALIC_COLOR = C_ITALIC_COLOR; BORDER_BOX_COLOR = C_BORDER_COLOR; BORDER_TEXT_COLOR = C_BORDER_TEXT_COLOR; LINK_COLOR = C_LINK_COLOR; LINK_HIGHLIGHTED_COLOR = C_LINK_HIGHLIGHTED_COLOR; } else if (MonoOrColor == COLOR_MODE && fancyscheme == 1) { TEXT_COLOR = F1_TEXT_COLOR; BOLD_COLOR = F1_BOLD_COLOR; ITALIC_COLOR = F1_ITALIC_COLOR; BORDER_BOX_COLOR = F1_BORDER_COLOR; BORDER_TEXT_COLOR = F1_BORDER_TEXT_COLOR; LINK_COLOR = F1_LINK_COLOR; LINK_HIGHLIGHTED_COLOR = F1_LINK_HIGHLIGHTED_COLOR; } else if (MonoOrColor == COLOR_MODE && fancyscheme == 2) { TEXT_COLOR = F2_TEXT_COLOR; BOLD_COLOR = F2_BOLD_COLOR; ITALIC_COLOR = F2_ITALIC_COLOR; BORDER_BOX_COLOR = F2_BORDER_COLOR; BORDER_TEXT_COLOR = F2_BORDER_TEXT_COLOR; LINK_COLOR = F2_LINK_COLOR; LINK_HIGHLIGHTED_COLOR = F2_LINK_HIGHLIGHTED_COLOR; } else { TEXT_COLOR = M_TEXT_COLOR; BOLD_COLOR = M_BOLD_COLOR; ITALIC_COLOR = M_ITALIC_COLOR; BORDER_BOX_COLOR = M_BORDER_COLOR; BORDER_TEXT_COLOR = M_BORDER_TEXT_COLOR; LINK_COLOR = M_LINK_COLOR; LINK_HIGHLIGHTED_COLOR = M_LINK_HIGHLIGHTED_COLOR; } if (AsciiExtendedChars == 0) { strcpy (Border22f, "+-+( )+-+"); strcpy (Border22if, "+-+( )+-+"); BarBlock1 = '.'; BarBlock2 = '#'; } show_mouse (); move_mouse (80, 25); drawmenu (); html_view (showcommand, base_dir, home_page, help_page); free (showcommand); hide_mouse (); if ((oldscreen != 0) && (forcemono == 0)) { load_window (X, Y, W, H, oldscreen); free (oldscreen); } conio_exit (); gotoxy (oldcursorx, oldcursory); return 0; }
int main(int argc, char **argv) { int i; int rval,ll; struct text *kk; /* If the user hits start, bail */ cont_btn_callback(0, CONT_START, (cont_btn_callback_t)arch_exit); pvr_init_defaults(); conio_init(CONIO_TTY_PVR, CONIO_INPUT_LINE); #if 0 /* revoke */ setgid(getgid()); #endif init(); /* Initialize everything */ /* signal(SIGINT,trapdel); */ #if 0 if (argc > 1) /* Restore file specified */ { /* Restart is label 8305 (Fortran) */ i = restore(argv[1]); /* See what we've got */ switch(i) { case 0: /* The restore worked fine */ yea=Start(); k=null; unlink(argv[1]);/* Don't re-use the save */ goto l8; /* Get where we're going */ case 1: /* Couldn't open it */ exit(1); /* So give up */ case 2: /* Oops -- file was altered */ rspeak(202); /* You dissolve */ exit(1); /* File could be non-adventure */ } /* So don't unlink it. */ } #endif startup(); /* prepare for a user */ for (;;) /* main command loop (label 2) */ { if (newloc<9 && newloc!=0 && closng) { rspeak(130); /* if closing leave only by */ newloc=loc; /* main office */ if (!apanic) clock2=15; apanic=TRUE; } rval=fdwarf(); /* dwarf stuff */ if (rval==99) die(99); l2000: if (loc==0) die(99); /* label 2000 */ kk = &stext[loc]; if ((abb[loc]%abbnum)==0 || kk->seekadr==0) kk = <ext[loc]; if (!forced(loc) && dark()) { if (wzdark && pct(35)) { die(90); goto l2000; } kk = &rtext[16]; } if (toting(bear)) rspeak(141); /* 2001 */ speak(kk); k=1; if (forced(loc)) goto l8; if (loc==33 && pct(25)&&!closng) rspeak(8); if (!dark()) { abb[loc]++; for (i=atloc[loc]; i!=0; i=linkx[i]) /*2004 */ { obj=i; if (obj>100) obj -= 100; if (obj==steps && toting(nugget)) continue; if (prop[obj]<0) { if (closed) continue; prop[obj]=0; if (obj==rug||obj==chain) prop[obj]=1; tally--; if (tally==tally2 && tally != 0) if (limit>35) limit=35; } ll = prop[obj]; /* 2006 */ if (obj==steps && loc==fixed[steps]) ll = 1; pspeak(obj, ll); } /* 2008 */ goto l2012; l2009: k=54; /* 2009 */ l2010: spk=k; l2011: rspeak(spk); } l2012: verb=0; /* 2012 */ obj=0; l2600: checkhints(); /* to 2600-2602 */ if (closed) { if (prop[oyster]<0 && toting(oyster)) pspeak(oyster,1); for (i=1; i<100; i++) if (toting(i)&&prop[i]<0) /*2604 */ prop[i] = -1-prop[i]; } wzdark=dark(); /* 2605 */ if (knfloc>0 && knfloc!=loc) knfloc=1; getin(&wd1,&wd2); #if 0 if (delhit) /* user typed a DEL */ { delhit=0; /* reset counter */ strcpy(wd1,"quit"); /* pretend he's quitting*/ *wd2=0; } #endif l2608: if ((foobar = -foobar)>0) foobar=0; /* 2608 */ /* should check here for "magic mode" */ turns++; if (demo && turns>=SHORT) done(1); /* to 13000 */ if (verb==say && *wd2!=0) verb=0; if (verb==say) goto l4090; if (tally==0 && loc>=15 && loc!=33) clock1--; if (clock1==0) { closing(); /* to 10000 */ goto l19999; } if (clock1<0) clock2--; if (clock2==0) { caveclose(); /* to 11000 */ continue; /* back to 2 */ } if (prop[lamp]==1) limit--; if (limit<=30 && here(batter) && prop[batter]==0 && here(lamp)) { rspeak(188); /* 12000 */ prop[batter]=1; if (toting(batter)) drop(batter,loc); limit=limit+2500; lmwarn=FALSE; goto l19999; } if (limit==0) { limit = -1; /* 12400 */ prop[lamp]=0; rspeak(184); goto l19999; } if (limit<0&&loc<=8) { rspeak(185); /* 12600 */ gaveup=TRUE; done(2); /* to 20000 */ } if (limit<=30) { if (lmwarn|| !here(lamp)) goto l19999; /*12200*/ lmwarn=TRUE; spk=187; if (place[batter]==0) spk=183; if (prop[batter]==1) spk=189; rspeak(spk); } l19999: k=43; if (liqloc(loc)==water) k=70; if (!strncmp(wd1,"enter",5) && (!strncmp(wd2,"strea",5)||!strncmp(wd2,"water",5))) goto l2010; if (!strncmp(wd1,"enter",5) && *wd2!=0) goto l2800; if ((strncmp(wd1,"water",5)&&strncmp(wd1,"oil",3)) || (strncmp(wd2,"plant",5)&&strncmp(wd2,"door",4))) goto l2610; if (at(vocab(wd2,1,0))) strcpy(wd2,"pour"); l2610: if (!strncmp(wd1,"west",4)) if (++iwest==10) rspeak(17); l2630: i=vocab(wd1,-1,0); if (i== -1) { spk=60; /* 3000 */ if (pct(20)) spk=61; if (pct(20)) spk=13; rspeak(spk); goto l2600; } k=i%1000; kq=i/1000+1; switch(kq) { case 1: goto l8; case 2: goto l5000; case 3: goto l4000; case 4: goto l2010; default: bug(22); } l8: switch(march()) { case 2: continue; /* i.e. goto l2 */ case 99: die(99); goto l2000; default: bug(110); } l2800: strcpy(wd1,wd2); *wd2=0; goto l2610; l4000: verb=k; spk=actspk[verb]; if (*wd2!=0 && verb!=say) goto l2800; if (verb==say) obj= *wd2; if (obj!=0) goto l4090; switch(verb) { case 1: /* take = 8010 */ if (atloc[loc]==0||linkx[atloc[loc]]!=0) goto l8000; for (i=1; i<=5; i++) if (dloc[i]==loc&&dflag>=2) goto l8000; obj=atloc[loc]; goto l9010; case 2: case 3: case 9: /* 8000 : drop,say,wave */ case 10: case 16: case 17: /* calm,rub,toss */ case 19: case 21: case 28: /* find,feed,break */ case 29: /* wake */ l8000: printf("%s what?\n",wd1); obj=0; goto l2600; case 4: case 6: /* 8040 open,lock */ spk=28; if (here(clam)) obj=clam; if (here(oyster)) obj=oyster; if (at(door)) obj=door; if (at(grate)) obj=grate; if (obj!=0 && here(chain)) goto l8000; if (here(chain)) obj=chain; if (obj==0) goto l2011; goto l9040; case 5: goto l2009; /* nothing */ case 7: goto l9070; /* on */ case 8: goto l9080; /* off */ case 11: goto l8000; /* walk */ case 12: goto l9120; /* kill */ case 13: goto l9130; /* pour */ case 14: /* eat: 8140 */ if (!here(food)) goto l8000; l8142: dstroy(food); spk=72; goto l2011; case 15: goto l9150; /* drink */ case 18: /* quit: 8180 */ gaveup=yes(22,54,54); if (gaveup) done(2); /* 8185 */ goto l2012; case 20: /* invent=8200 */ spk=98; for (i=1; i<=100; i++) { if (i!=bear && toting(i)) { if (spk==98) rspeak(99); blklin=FALSE; pspeak(i,-1); blklin=TRUE; spk=0; } } if (toting(bear)) spk=141; goto l2011; case 22: goto l9220; /* fill */ case 23: goto l9230; /* blast */ case 24: /* score: 8240 */ scorng=TRUE; printf("If you were to quit now, you would score"); printf(" %d out of a possible ",score()); printf("%d.",mxscor); scorng=FALSE; gaveup=yes(143,54,54); if (gaveup) done(2); goto l2012; case 25: /* foo: 8250 */ k=vocab(wd1,3,0); spk=42; if (foobar==1-k) goto l8252; if (foobar!=0) spk=151; goto l2011; l8252: foobar=k; if (k!=4) goto l2009; foobar=0; if (place[eggs]==plac[eggs] ||(toting(eggs)&&loc==plac[eggs])) goto l2011; if (place[eggs]==0&&place[troll]==0&&prop[troll]==0) prop[troll]=1; k=2; if (here(eggs)) k=1; if (loc==plac[eggs]) k=0; move(eggs,plac[eggs]); pspeak(eggs,k); goto l2012; case 26: /* brief=8260 */ spk=156; abbnum=10000; detail=3; goto l2011; case 27: /* read=8270 */ if (here(magzin)) obj=magzin; if (here(tablet)) obj=obj*100+tablet; if (here(messag)) obj=obj*100+messag; if (closed&&toting(oyster)) obj=oyster; if (obj>100||obj==0||dark()) goto l8000; goto l9270; case 30: /* suspend=8300 */ spk=201; if (demo) goto l2011; printf("I can suspend your adventure for you so"); printf(" you can resume later, but\n"); printf("you will have to wait at least"); printf(" %d minutes before continuing.",latncy); if (!yes(200,54,54)) goto l2012; datime(&saved,&savet); ciao(); /* Do we quit? */ continue; /* Maybe not */ case 31: /* hours=8310 */ printf("Colossal cave is closed 9am-5pm Mon "); printf("through Fri except holidays.\n"); goto l2012; default: bug(23); } l4090: switch(verb) { case 1: /* take = 9010 */ l9010: switch(trtake()) { case 2011: goto l2011; case 9220: goto l9220; case 2009: goto l2009; case 2012: goto l2012; default: bug(102); } l9020: case 2: /* drop = 9020 */ switch(trdrop()) { case 2011: goto l2011; case 19000: done(3); case 2012: goto l2012; default: bug(105); } case 3: switch(trsay()) { case 2012: goto l2012; case 2630: goto l2630; default: bug(107); } l9040: case 4: case 6: /* open, close */ switch(tropen()) { case 2011: goto l2011; case 2010: goto l2010; default: bug(106); } case 5: goto l2009; /* nothing */ case 7: /* on 9070 */ l9070: if (!here(lamp)) goto l2011; spk=184; if (limit<0) goto l2011; prop[lamp]=1; rspeak(39); if (wzdark) goto l2000; goto l2012; case 8: /* off */ l9080: if (!here(lamp)) goto l2011; prop[lamp]=0; rspeak(40); if (dark()) rspeak(16); goto l2012; case 9: /* wave */ if ((!toting(obj))&&(obj!=rod||!toting(rod2))) spk=29; if (obj!=rod||!at(fissur)||!toting(obj)||closng) goto l2011; prop[fissur]=1-prop[fissur]; pspeak(fissur,2-prop[fissur]); goto l2012; case 10: case 11: case 18: /* calm, walk, quit */ case 24: case 25: case 26: /* score, foo, brief */ case 30: case 31: /* suspend, hours */ goto l2011; l9120: case 12: /* kill */ switch(trkill()) { case 8000: goto l8000; case 8: goto l8; case 2011: goto l2011; case 2608: goto l2608; case 19000: done(3); default: bug(112); } l9130: case 13: /* pour */ if (obj==bottle||obj==0) obj=liq(); if (obj==0) goto l8000; if (!toting(obj)) goto l2011; spk=78; if (obj!=oil&&obj!=water) goto l2011; prop[bottle]=1; place[obj]=0; spk=77; if (!(at(plant)||at(door))) goto l2011; if (at(door)) { prop[door]=0; /* 9132 */ if (obj==oil) prop[door]=1; spk=113+prop[door]; goto l2011; } spk=112; if (obj!=water) goto l2011; pspeak(plant,prop[plant]+1); prop[plant]=(prop[plant]+2)% 6; prop[plant2]=prop[plant]/2; k=null; goto l8; case 14: /* 9140 - eat */ if (obj==food) goto l8142; if (obj==bird||obj==snake||obj==clam||obj==oyster ||obj==dwarf||obj==dragon||obj==troll ||obj==bear) spk=71; goto l2011; l9150: case 15: /* 9150 - drink */ if (obj==0&&liqloc(loc)!=water&&(liq()!=water ||!here(bottle))) goto l8000; if (obj!=0&&obj!=water) spk=110; if (spk==110||liq()!=water||!here(bottle)) goto l2011; prop[bottle]=1; place[water]=0; spk=74; goto l2011; case 16: /* 9160: rub */ if (obj!=lamp) spk=76; goto l2011; case 17: /* 9170: throw */ switch(trtoss()) { case 2011: goto l2011; case 9020: goto l9020; case 9120: goto l9120; case 8: goto l8; case 9210: goto l9210; default: bug(113); } case 19: case 20: /* 9190: find, invent */ if (at(obj)||(liq()==obj&&at(bottle)) ||k==liqloc(loc)) spk=94; for (i=1; i<=5; i++) if (dloc[i]==loc&&dflag>=2&&obj==dwarf) spk=94; if (closed) spk=138; if (toting(obj)) spk=24; goto l2011; l9210: case 21: /* feed */ switch(trfeed()) { case 2011: goto l2011; default: bug(114); } l9220: case 22: /* fill */ switch(trfill()) { case 2011: goto l2011; case 8000: goto l8000; case 9020: goto l9020; default: bug(115); } l9230: case 23: /* blast */ if (prop[rod2]<0||!closed) goto l2011; bonus=133; if (loc==115) bonus=134; if (here(rod2)) bonus=135; rspeak(bonus); done(2); l9270: case 27: /* read */ if (dark()) goto l5190; if (obj==magzin) spk=190; if (obj==tablet) spk=196; if (obj==messag) spk=191; if (obj==oyster&&hinted[2]&&toting(oyster)) spk=194; if (obj!=oyster||hinted[2]||!toting(oyster) ||!closed) goto l2011; hinted[2]=yes(192,193,54); goto l2012; case 28: /* break */ if (obj==mirror) spk=148; if (obj==vase&&prop[vase]==0) { spk=198; if (toting(vase)) drop(vase,loc); prop[vase]=2; fixed[vase]= -1; goto l2011; } if (obj!=mirror||!closed) goto l2011; rspeak(197); done(3); case 29: /* wake */ if (obj!=dwarf||!closed) goto l2011; rspeak(199); done(3); default: bug(24); } l5000: obj=k; if (fixed[k]!=loc && !here(k)) goto l5100; l5010: if (*wd2!=0) goto l2800; if (verb!=0) goto l4090; printf("What do you want to do with the %s?\n",wd1); goto l2600; l5100: if (k!=grate) goto l5110; if (loc==1||loc==4||loc==7) k=dprssn; if (loc>9&&loc<15) k=entrnc; if (k!=grate) goto l8; l5110: if (k!=dwarf) goto l5120; for (i=1; i<=5; i++) if (dloc[i]==loc&&dflag>=2) goto l5010; l5120: if ((liq()==k&&here(bottle))||k==liqloc(loc)) goto l5010; if (obj!=plant||!at(plant2)||prop[plant2]==0) goto l5130; obj=plant2; goto l5010; l5130: if (obj!=knife||knfloc!=loc) goto l5140; knfloc = -1; spk=116; goto l2011; l5140: if (obj!=rod||!here(rod2)) goto l5190; obj=rod2; goto l5010; l5190: if ((verb==find||verb==invent)&&*wd2==0) goto l5010; printf("I see no %s here\n",wd1); goto l2012; } }