/* Instant Graphics! terminal accessory version 2.17 Copyright 1988-92 by Larry G. Mears All rights reserved. Written with Laser C Source Code use Agreement: 4-19-92 The time has come to make this available. If you use my IG 2.17 code in any form or fashion, be it direct or intellectial property wise in your works you must mention that you used the Instant Graphics! source by Larry G. Mears in your documentation and somewhere in your program if it shows credits. Also any work that you do that involved the Instant Graphics source I would like for you to send me a free "registered" or comercial version of your working program/product to me for my own use. There are no other strings attached. Mailing address: Larry Mears 11027 Crestfield Dr. Huntsville, AL 35803 USA BTW the biosmwc.h is really bios.h from Mark Williams C It's copyrighted so I couldn't include it. You also need to get GIST the GI Sound Tool and from the ALCYON folder you need SNDINIT.O and SNDSUBS.O to link in for the sound effects. I have been compiling this code with Laser C v1.1 */ #include #include #include #include #include #include #include #include /* DEFINES */ #define TRUE 1 #define FALSE 0 #define CON 2 #define AUX 1 #define CLK_TCK 200 /* EXTERNALS */ extern int gl_apid; extern snd_on(),snd_off(),install_int(),remove_int(),init_snds(), stop_snd(); /* GLOBAL VARIABLES */ int menu_id ; /* our menu id */ int handle; /* virtual workstation handle */ int msgbuff[8]; /* event message buffer */ int keycode; /* keycode returned by event-keyboard */ int ret; /* dummy return variable */ int mx,my; /* mouse x and y pos. */ int butdown; /* button state tested for, UP/DOWN */ int hidden; /* current state of cursor */ int contrl[12]; int intin[128]; int ptsin[128]; int intout[128]; int ptsout[128]; /* storage wasted for idiotic bindings */ int work_in[12]; /* Input to GSX parameter array */ int work_out[57]; /* Output from GSX parameter array */ int pxyarray[10]; /* input point array */ int lines[4]; /* for lines points drawto */ int g_s=0, g_res; /* graphics scaling flag */ int rnd_f=0, rnd_t=199, r_lp=0; /* random range */ /*LooP command Globals*/ int lp1,lp2,lp3,lp4,lp5,lp_flg=0, lp_effect[2049], lp_2nd, lp_was; lp_com; int lp_eff_ct=0, lp_num_prams, lp_x, lp_1st, lp_type, lp_no_prams, bad_cmd=0; /* point & click vars */ char r_but_tran[82]; /* string tran'ed at right button click [0]=len, 81=CR FLAG */ char x_r_but=0; /* right mouse button string tran flag*/ char zone_cmds[48][81]; /* command string associated with each zone */ int zone[48][4]; /* zone ID and zone rect defines */ int zone_loopback=0; /* file storage & misc varibles */ unsigned char filename[512]; unsigned char filebuffer[4096], ig_midi[10001], mem_key[129], mem_key_cr, mem_key_flg=0; unsigned long int file_length, bytes_read, bytes_left, bytes_parsed, num_bytes, f_ct; int filehandle, help, midi_len=0, w_1st_pass=0, mem_key_ct=0; int x_on=1, x_times=1, x_times_x=1; char f_key, midi_on=1, mouse_CR=0, des_backsp=0; unsigned char x_on_char=17, x_off_char=19; /* storage for "WRITTEN" text */ unsigned char text[132]=" Glory to the Lord Jesus Christ! \0"; /* storage for screen */ struct { int *image; int width; int height; int wordw; int flag; int planes; int r1,r2,r3; } sourceMFDB, destMFDB; int bitblt_storage[16640], vd1,vd2,vd3,vd4; /* allow whole screen */ int original_rez, r_lock=0; int org_color[16] [3]; int sys_color[16] [3] = { { 1000,1000,1000 }, { 0,0,0 }, { 1000,0,0 }, { 0,1000,0 }, { 0,0,1000 }, { 0,1000,1000 }, { 1000,1000,0 }, { 1000,0,1000 }, { 714,571,857 }, { 714,428,285 }, { 1000,571,428 }, { 0,571,428 }, { 428,428,428 }, { 571,571,571 }, { 714,714,714 }, { 857,857,857 } }; /* storage for attributes restore */ int polym_sets[4], m_bar[800], line_sets[6], fill_sets[4], text_sets[10]; int snd_patches[20][56]; /* To hold data below for restoring snd patches for GIST */ /* Data for GIST sounds */ int only_1st_time=0; int landing[] = { 700, 78, -1, 15, 1, 0, 24576, -1, -1229, 0, 0, -1, -9830, 0, 0, 0, 0, 0, 1, -3072, -16384, -3072, -16384, 10, -9706, 1052, 30787, 0, -1848, 5644, -25803, 3612, -29621, 3612, -29621, -2374, -17340, -1519, 7252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int aa[] = { 28, 477, -1, 15, 1, 1, 4681, -5, 27853, 5, -9830, -1, -1278, 7, -32768, 7, -32768, 14, 1, -4080, -256, -4080, -256, 0, 0, -4080, -256, 18, -30086, 1696, 13405, -1200, -26066, 1696, 13405, -1200, -26066, -1200, -26066, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int ab[] = { 200, 477, -1, 15, 1, 15, 0, -1, -1267, 10, 3277, -1, -2573, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 2926, -8, 27220, 7, -16776, -85, -17949, -8, 27220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int ac[] = { 8, 1250, 31, 15, 1, 3, -16384, -1, -7562, 0, 0, -1, -10923, 0, 0, 1, 19988, 0, 1, -4080, -256, -4080, -256, 114, -4444, -57, -24712, 56, 24712, 0, 0, -3584, -8192, 28665, 0, 0, 0, -3584, -8192, 0, 1, -3, -14043, -31, 0, 31, 0, 0, 0, 1, -29491, 0, 0, 0, 0, 0 }; int ad[] = { 8, 284, -1, 15, 1, 3, -16384, -1, -8192, 0, 0, -1, -8937, 0, 0, 0, 0, 0, 1, -4057, 2971, -4057, 2971, 338, 5214, 0, 0, 4056, -2971, 28665, 0, -8, -10895, 57, 21627, -3584, -8192, -8, -10895, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int ae[] = { 8, 625, -1, 15, 1, 3, -16384, -1, -32768, 0, 0, -1, -10923, 5, -19661, 5, -19661, 0, 1, -594, -20719, -2374, -17340, 1186, -24098, 0, 0, 2373, 17340, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int af[] = { 500, 477, 16, 15, 1, 0, 17873, 0, 0, 15, 0, -1, -410, 1, -22938, 0, -30933, 0, 1, 12, -28542, 1696, 13405, -13, 18541, -2374, -17340, 0, -26652, 448, -20514, -170, 10530, 188, 29395, -405, -24861, -170, 10530, 0, 1, -1, -25395, -31, 0, 0, 3694, 31, 0, -1, -4515, 0, 0, -9, -31562, 0 }; int ag[] = { 200, 477, 31, 15, 1, 15, 0, -1, -1267, 10, 3277, -1, -2573, 0, 0, 0, 0, 0, 1, -9, 18470, -140, -32161, 0, 5504, 28, 31652, 0, 3679, 1656, 13223, 430, -25398, 430, -25398, -1180, -16857, -307, 25764, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int ah[] = { 40, 477, -1, 15, 1, 5, 0, -1, -1248, 10, 3277, -1, -2533, 0, 0, 0, 0, 0, 1, -9, 18470, -140, -32161, 0, 2270, -57, -24712, -1, -3337, 1656, 13223, 430, -25398, 430, -25398, -1180, -16857, -307, 25764, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int ai[] = { 20, 52, -1, 15, 1, 15, 0, -1, -9830, 12, 0, -1, -1024, 1, -32768, 0, 9830, 160, 1, -28, 360, -112, 1442, 3, 31133, -57, -24712, 0, -11989, 57, 10752, -6, 23743, 5, -18586, -57, -24712, -6, 23743, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int aj[] = { 100, 477, -1, 15, 1, 3, -16384, -1, -4572, 12, 0, -1, -1966, 1, -32768, 0, 7864, 0, 1, -4080, -256, -4080, -256, 10, 12944, 0, 0, 10, 12944, 293, -5746, -264, -17086, 282, 10212, -275, -15067, -264, -17086, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int ak[] = /* radio broadcast */ { 800, 954, 23, 15, 1, 0, -32768, -1, -69, 14, 6554, -15, -6554, 7, 22938, 5, 19137, 0, 1, -30, -20744, -3665, 28433, 0, 5618, -3584, -8192, 0, -26399, 10977, -21383, -72, 27596, 263, 30420, -2983, -29831, -72, 27596, 30, 1, 1, -9175, 29, -15729, -2, 17302, -31, 0, 0, 15049, 15, -32768, -4, -6554, 145 }; int al[] = /* bounce ball */ { 8, 284, -1, 15, 1, 3, -16384, -1, -8192, 0, 0, -1, -8937, 0, 0, 0, 0, 0, 1, -4057, 2971, -4057, 2971, 338, 5214, 0, 0, 4056, -2971, 28665, 0, -8, -10895, 57, 21627, -3584, -8192, -8, -10895, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int am[] = /* eerie sound */ { 200, 477, -1, 15, 1, 0, -13797, -1, 26214, 14, 26214, -1, -16852, 0, 0, 0, 0, 0, 0, -4, 30423, -29, -18758, 5, -22463, 0, 0, 28, 18758, 86, 2926, -11, -7397, 10, 21323, -85, -17949, -11, -7397, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int an[] = /* harley motorcycle */ { 500, 1923, 15, 15, 1, 0, 15124, -1, -21, 14, -29491, -15, 29491, 7, -32768, 2, 26214, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5644, -25803, -1899, 25450, 4515, -20642, -2374, -17340, -1899, 25450, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, -5243, -6, 3146, 0 }; int ao[] = /* helicopter */ { 500, 62, 15, 15, 1, 0, 15124, -1, -21, 14, -29491, -15, 29491, 2, 6554, 0, -27001, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12285, 0, -738, -6554, 2948, 26214, -3072, -16384, -738, -6554, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, -5243, -6, 3146, 0 }; int ap[] = /* steam locomotive */ { 800, -1, 23, 15, 1, 0, 9362, -1, -93, 12, 29491, -1, -136, 7, 13107, 1, 25061, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, -9175, 29, -15729, -2, 17302, -31, 0, 0, 15049, 15, -32768, -4, -6554, 145 }; int aq[] = /* nice wave sound */ { 400, 238, -1, 15, 1, 0, 16384, -1, -337, 14, 6554, -1, -154, 5, -9830, 1, -23724, 15, 1, -300, 9867, -1200, -26066, 86, 3191, -167, 12227, 0, 1822, 12285, 0, -7, -9339, 24, -28180, -3072, -16384, -7, -9339, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int ar[] = /* robot walk */ { 8, 1330, -1, 15, 1, 3, -16384, -1, -8192, 0, 0, -1, -8937, 0, 0, 0, 0, 0, 1, -4057, 2971, -4057, 2971, 338, 5214, 0, 0, 4056, -2971, 28665, 0, -3584, -8192, 28665, 0, -3584, -8192, -3584, -8192, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int as[] = /* passing plane */ { 50, 477, -1, 15, 1, 0, 24576, -1, -2048, 11, 16384, -1, -2633, 0, 0, 0, 0, 0, 1, -582, -10279, -4069, -6415, 54, 25814, -1077, -28428, 4, 9184, 28665, 0, -1577, 27853, 12612, -26214, -3584, -8192, -1577, 27853, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* GSX UTILITY ROUTINES */ hide_mouse() { if(! hidden){ graf_mouse(M_OFF,0x0L); hidden=TRUE; } } show_mouse() { if(hidden){ graf_mouse(M_ON,0x0L); hidden=FALSE; } } /* open virtual workstation */ open_vwork() { int i, nul; for(i=0, work_in[10]=2; i<10; work_in[i++]=1); handle = graf_handle(&nul, &nul, &nul, &nul); v_opnvwk(work_in,&handle,work_out); /*v_clrwk(handle);*/ } /* set clipping rectangle */ set_clip(x,y,w,h) int x,y,w,h; { int clip[4]; clip[0]=x; clip[1]=y; clip[2]=x+w; clip[3]=y+h; vs_clip(handle,1,clip); } /* Accessory Init. Until First Event_Multi */ main() { appl_init(); menu_id=menu_register(gl_apid," IG 2.17 "); original_rez=Getrez(); multi(); } /* dispatches GEM accessory tasks */ multi() { int event; while (TRUE) { event = evnt_multi(MU_MESAG, 1,1,butdown, 0,0,0,0,0, 0,0,0,0,0, msgbuff,0,0,&mx,&my,&ret,&ret,&keycode,&ret); if (event & MU_MESAG) switch (msgbuff[0]) { case AC_CLOSE: v_clsvwk(handle); appl_exit(); break; case AC_OPEN: if (msgbuff[4] == menu_id) user_main(); break; } } /* while (TRUE) */ } user_main() { register long key; int flag1,g_on, reg, a, b, plex, res; int line[4], r_row,r_column,snd_num,snd_ele; char *oldphys; long u_stack; open_vwork(); help=0; /*** save VDI settings for restoration ***/ vqm_attributes(handle,polym_sets); vql_attributes(handle,line_sets); line_sets[4]=intout[3]; line_sets[5]=intout[4]; vqf_attributes(handle,fill_sets); vqt_attributes(handle,text_sets); hide_mouse(); install_int(); init_snds(); /**** get original color palette ****/ reg=0; plex=0; do { vq_color(handle,reg,1,org_color[reg]); reg++; } while (reg != 16); /* save menu bar*/ /* if I do this much past 870 the string constants get screwed */ oldphys = ( char *)Physbase(); a=0; b=0; u_stack = Super(0L); do { m_bar[b]= peekw(oldphys+a); a ++; b ++; } while(b<800); Super(u_stack); clip_set(); form_dial(0,0,0,0,0,0,0,639,399); /*Store GIST sounds for restore */ only_1st_time++; if(only_1st_time==1) { for(snd_num=0;snd_num<20;snd_num++) { for(snd_ele=0;snd_ele<56;snd_ele++) { switch(snd_num) { case 0: snd_patches[0][snd_ele]=aa[snd_ele]; break; case 1: snd_patches[1][snd_ele]=ab[snd_ele]; break; case 2: snd_patches[2][snd_ele]=ac[snd_ele]; break; case 3: snd_patches[3][snd_ele]=ad[snd_ele]; break; case 4: snd_patches[4][snd_ele]=ae[snd_ele]; break; case 5: snd_patches[5][snd_ele]=af[snd_ele]; break; case 6: snd_patches[6][snd_ele]=ag[snd_ele]; break; case 7: snd_patches[7][snd_ele]=ah[snd_ele]; break; case 8: snd_patches[8][snd_ele]=ai[snd_ele]; break; case 9: snd_patches[9][snd_ele]=aj[snd_ele]; break; case 10: snd_patches[10][snd_ele]=ak[snd_ele]; break; case 11: snd_patches[11][snd_ele]=al[snd_ele]; break; case 12: snd_patches[12][snd_ele]=am[snd_ele]; break; case 13: snd_patches[13][snd_ele]=an[snd_ele]; break; case 14: snd_patches[14][snd_ele]=ao[snd_ele]; break; case 15: snd_patches[15][snd_ele]=ap[snd_ele]; break; case 16: snd_patches[16][snd_ele]=aq[snd_ele]; break; case 17: snd_patches[17][snd_ele]=ar[snd_ele]; break; case 18: snd_patches[18][snd_ele]=as[snd_ele]; break; case 19: snd_patches[19][snd_ele]=landing[snd_ele]; break; } /* end switch */ } /* end for snd_ele */ } /* end for snd_num */ } /* endif only_1st_time */ help_1display(); flag1=5; g_on=1; for(;;) { vq_mouse(handle,&butdown,&mx,&my); if(mouse_CR && butdown==1) { while(butdown==1) vq_mouse(handle,&butdown,&mx,&my); while(Bcostat(BC_AUX)==0); Bconout(BC_AUX,13); if(mouse_CR==2) Bconout(BC_AUX,10); } if(butdown==2 && x_r_but==1) { for(a=1;a<=r_but_tran[0];a++) { while(Bcostat(BC_AUX)==0); Bconout(BC_AUX,r_but_tran[a]); } while(Bcostat(BC_AUX)==0); if(r_but_tran[81]) Bconout(BC_AUX,13); while(butdown) { vq_mouse(handle,&butdown,&mx,&my); } } if (Bconstat(BC_CON)) { key = Bconin(BC_CON); if ((int)key == 0) { key >>= 16; if (key == KC_UNDO) { Cconws("\33f"); if(!Getrez()) rez_change_med(); flash_fix(); /* left shift do a elimatnate status line */ if(Kbshift(-1)==2) Setscreen(-1L,-1L,original_rez); break; } if(key == KC_F5) { if(r_lock==1) r_lock=0; else { r_lock=1; Bconout(CON,7); } } if (key == KC_HELP) help_display(); if (key == KC_INS) /* configure baud */ set_baud(); if (key == KC_CLR) { /* restore attributes and pallet */ if(!Getrez) rez_change_med(); org_pallet(); reset_attributes(); Cconws("\33q\33c0\33b3\33E"); } /* CURSOR MOVEMENT from KEYBOARD */ if(key==KC_CUP) { Bconout(BC_AUX,27); Bconout(BC_AUX,'A'); if(plex) Cconws("\33A"); } if(key==KC_CDOWN) { Bconout(BC_AUX,27); Bconout(BC_AUX,'B'); if(plex) Cconws("\33B"); } if(key==KC_CLEFT) { Bconout(BC_AUX,27); Bconout(BC_AUX,'D'); if(plex) Cconws("\33D"); } if(key==KC_CRIGHT) { Bconout(BC_AUX,27); Bconout(BC_AUX,'C'); if(plex) Cconws("\33C"); } if (key == KC_F10) /* F10 graphics off */ g_on=0; if (key == KC_F6) { /* half plex toggle */ plex++; if(plex>1) { plex=0; Cconws("\n\rFULL PLEX"); } if(plex) Cconws("\n\rHALF PLEX"); } if (key == KC_F4) { /* MIDI on\off toggle */ midi_on++; if(midi_on>1) { midi_on=0; Cconws("\n\rMIDI off\n\r"); } if(midi_on) Cconws("\n\rMIDI on\n\r"); } if (key == KC_F8 || key==KC_F7) { /* F8 display file */ help=0; if (key==KC_F7) help=2; file_find(); file_length = num_bytes; bytes_left = file_length; if (file_length>0) { filehandle = Fopen(&filename[2],1); if(filehandle>=0) { display_file(); Fclose(filehandle); } } } if (key == KC_F9) /* F9 graphics on */ g_on=1; } else { while (Bcostat(BC_AUX) == 0) ; Bconout(BC_AUX, (int)key); if(plex) Bconout(BC_CON, (int)key); } } if (Bconstat(BC_AUX)) { key = Bconin(BC_AUX); if ((flag1==0 && (int)key != '#') || (flag1==0 && g_on==0)) { Bconout(BC_CON,'G'); if((int)key!='G') Bconout(BC_CON, (int)key); } if (flag1 !=0 && (int)key != 'G' ) Bconout(BC_CON, (int)key); if(des_backsp && (int)key==8) { Bconout(BC_CON,32); Bconout(BC_CON,8); } flag1++; if ( flag1 > 30000 ) flag1=5; if ( (int)key =='G' ) flag1=0; if ( (int)key =='#' && flag1 == 1 && g_on ) do_graphics(); } } org_pallet(); reset_attributes(); remove_int(); res=Getrez(); if (!res && original_rez==1 ) rez_change_med(); Cconws("\33E\33f\33q\33c0\33b3\33Y7o"); form_dial(3,0,0,0,0,0,0,639,399); show_mouse(); /* restore menu bar */ a=0; b=0; u_stack = Super(0L); do { pokew(oldphys+a,m_bar[b]); a ++; b ++; } while(b<800); Super(u_stack); clip_set(); line[0]=0; line[1]=10; line[2]=639; line[3]=10; /* drop line lower for mono */ if (original_rez==2) { line[1]=19; line[3]=19; } v_pline(handle, 2, line); } /********************************************************/ do_graphics() { int points[2], sides[4], rgb[3], rgb2[3]; static int current_palette[16] [3], previous_palette[16] [3]; int recieving, key, chain, rez, ct, i,lp_ct,did_loop; int p1, p2, p3, val, v1, v2, v3, tries, out_of_range; int v4,v5,v6,v7,pxy[8],settings[4],snd_num,snd_ele; unsigned char rx,ry, is_gang='X', chain_gang[132]; unsigned long rd, clock_t, timer1, timer2; do { recieving=1; ct=0,did_loop=0; timer1 = clock1(); while (recieving) { timer2 = clock1(); if (Bconstat(BC_AUX)) { ct++; if ( ct==1 ) key = Bconin(BC_AUX); if ( ct==2 ) { chain = Bconin(BC_AUX); recieving=0; } } /* time out in 5 seconds */ if ( ((timer2/CLK_TCK)-(timer1/CLK_TCK)) > 4 ) { recieving=0; chain='X'; Bconout(BC_CON,7); } } if (key=='&') { /*** LooP command settings ***/ /* & From,To,Step,Delay,COMMAND(, or |=Xor @=get_text)num_prams,x,y,const */ lp_flg=0; lp1=value(0); lp2=value(0); lp3=value(0); lp4=value(0); if(lp1>lp2){ lp_ct=lp3; lp3=0-lp_ct; } if(lp3==0) lp3=1; key=get_aux_char(); lp_com=is_gang=key; if(is_gang=='>') { get_text(); for(v1=0; v1<128; v1++) chain_gang[v1]=text[v1]; } lp_type=get_aux_char(); lp_num_prams=value(0); if (lp_num_prams<1) lp_num_prams=1; if(lp_num_prams>2048) lp_num_prams=2048; lp_flg=0; /* 1st pass set array flags */ lp5=lp1; r_lp=1; /* set rnd detect make flgs in array */ for(lp_ct=0;lp_ct -30000 && lp_effect[lp_ct]<0)) lp_no_prams=0; } } do { /** do Loop for the '&' command **/ bad_cmd=0; if(is_gang=='>') { v1=value(0); if(v1<0 || v1>127) v1=0; key=lp_com=chain_gang[v1]; } /******Graphics commands section ******/ if(key=='<') { /* GET_KEY_TRAN < x,y,z x=0 tran key only x=1 tran with CR y=0 hot key input y=1 CR required y=2 MOUSE ZONE z= output choice to screen? 1=yes 0=no 2=yes toss, 3=no toss <- if toss no transmitt anything. GET a keys remember till chain is broke then transmit to host. */ mem_key_cr=value(0); val=value(0); v5=value(0); mem_key_flg=1; mem_key_ct=0; if(v5==2) mem_key_flg=0; if(v5==3) { v5=0; mem_key_flg=0; } do { if(val!=2) { v4=Bconin(BC_CON); if(v4==127 || v4==8 && mem_key_ct>0) mem_key_ct--; if(v4>31 && v4<127) { if(mem_key_ct<129) { mem_key_ct++; mem_key[mem_key_ct]=v4; if(v5) Bconout(BC_CON,mem_key[mem_key_ct]); } } if(v5 && v4==127 || v4==8) { Bconout(BC_CON,27); Bconout(BC_CON,'D'); Bconout(BC_CON,' '); Bconout(BC_CON,27); Bconout(BC_CON,'D'); } if(v4==13) val=0; } /* endif val!=2) */ /************************************/ if(val==2) { /* MOUSE ZONE for POINT and CLICK */ /* part of the "<" command. */ zone_jmp: vq_mouse(handle,&v1,&v2,&v3); /* poll the mouse */ vqm_attributes(handle,settings); vswr_mode(handle,3); i=0; points[0]=10000; points[1]=10000; do { vq_mouse(handle,&v1,&v2,&v3); if( points[0] != v2 || points[1] != v3) { if(i==1) v_pmarker(handle,1,points); points[0]=v2; points[1]=v3; i=1; v_pmarker(handle,1,points); } } while(!v1); /* don't exit till button released */ do vq_mouse(handle,&p1,&p2,&p3); while(p1); v_pmarker(handle,1,points); vswr_mode(handle,settings[3]); v7=1; if(zone_loopback) v7=2; for(i=0;i<=47;i++) { if(v2>=zone[i][0] && v2<=zone[i][2] && v3>=zone[i][1] && v3<=zone[i][3] ) { v7=0; break; } } if(v7==1) i=47; /* default to last zone */ if(v7==2) { Bconout(BC_CON,7); goto zone_jmp; } mem_key_ct=zone_cmds[i][0]; for(v6=1;v60); } if(key=='N') { /* NOISE N x,num_bytes */ /* x=0 load midi buff */ /* x=1 load and execute */ /* x=2 execute buff NO num_bytes given */ /* x=3 load buff for CHIP */ /* x=4 load buff for chip and exe */ /* x=5 exe buff with chip commands */ val=value(0); if(val==2 || val==5) v1=midi_len; if(val!=2 && val!=5) { v1=value(0); midi_len=v1; for(p1=0;p12) { p3=midi_on; midi_on=0; } } if(midi_on && val<3) { xoff(); for(p2=1;p210000) p2=10000; v2=ig_midi[p2-1]; /* MIDI out */ Bconout(3,v2); timer1=clock1(); /* do timing */ while(clock1()-timer12) midi_on=p3; if(val==4 || val==5 && v1>5) { for(p1=0;p110000) p1=10000; play_note(ig_midi[p1],ig_midi[p1+1],ig_midi[p1+2],ig_midi[p1+3],ig_midi[p1+4],ig_midi[p1+5]); } } } if (key=='X') { /* extended commands section */ /* extended commands are identified by a X and a number value 0 thru 9999. This allows 10,000 new commands to be introduced. */ val= value(0); /*----------------------------------------------------------------------------*/ /* 0, left_x,left_y, range_x,range_y, num_dots spray paint */ /* the ranges can only be 0 thru 255 */ if(val==0) { p1= value(1); p2= value(2); v1= value(1); v2= value(2); v3= value(0); for(p3=0;p3v1) { out_of_range=1; rd=Random(); rx=(char)rd; } if(ry>v2) { out_of_range=1; rd=Random(); ry=(char)rd; } if(tries>8) { out_of_range=0; rx=0; ry=0; } } while(out_of_range); points[0]=p1+rx; points[1]=p2+ry; v_pmarker(handle,1,points); } } /***** end of spray paint *****/ /***************************Setcolor register**************************/ /* X 1,register,value register 0-15 value 0-1911 */ if(val==1) { /* Setcolor register with Xbios */ p1= value(0); p2= value(0); if(p1>15) p1=15; /* if(p2>1911) p2=1911; kill may allow 4096 colors */ Setcolor(p1,p2); } /******** Set RANDOM from to range *******/ /* X 2,from,to */ if(val==2) { rnd_f=value(0); rnd_t=value(0); if(rnd_f<0) rnd_f=0; if(rnd_t2) v1=0; if(v1==0) x_r_but=0; /* X 3,OFF? */ if(v1==1) { /* X 3,ON,CR? */ x_r_but=1; r_but_tran[81]=value(0); } if(v1==2) { /*X 3,2,ON,CR?,string len,string */ v4=value(0); if(v4==0) x_r_but=0; else x_r_but=1; r_but_tran[81]=value(0); r_but_tran[0]=value(0); if(r_but_tran[0]>80) r_but_tran[0]=80; if(r_but_tran[0]<1) r_but_tran[0]=1; if(lp_flg==1) xon(); for(v2=1;v2<=r_but_tran[0];v2++) r_but_tran[v2]=get_aux_char(); v3=get_aux_char(); /* dead get for seperator */ } } /************ LOAD ZONE DATA FOR POINT & CLICK *******/ if(val==4) { /* zone_num,up_left_x,up_left_y, lower_right_x,lower_right_y, cmd_string_len,cmd_string: */ v1=value(0); if(v1>47 && v1!=9999 && v1!=9998 && v1!=9997) v1=47; /* zone_num */ /* if X 4,9999: zero zones */ if(v1==9999) for(p1=0;p1<48;p1++) { zone[p1][0]=-1; zone[p1][1]=-1; zone[p1][2]=-1; zone[p1][3]=-1; } /* if X 4,9998: SET ZONE loopback on invalid selection */ if(v1==9998) zone_loopback=1; /*ON*/ if(v1==9997) zone_loopback=0; /*OFF*/ if(v1<9997) { zone[v1][0]=value(1); /* up_left_x */ zone[v1][1]=value(2); /* up_left_y */ zone[v1][2]=value(1); /* lower_right_x */ zone[v1][3]=value(2); /* lower_right_y */ v2=value(0); if(v2>80) v2=80; /* cmd_string_len */ if(v2<1) v2=1; zone_cmds[v1][0]=v2; if(lp_flg==1) xon(); for(v3=1;v3<=zone_cmds[v1][0];v3++) zone_cmds[v1][v3]=get_aux_char(); v4=get_aux_char(); /* dead get for seperator */ } /* endif v1<9997 */ } /************ XON XOFF shutdown ***************/ if(val==5) { /* 0=off 1=on */ /* 2=set xon xtimes */ /* 3=set xoff xtimes*/ /* 4 = set default */ x_on=value(0); if(lp_flg) x_on=1; if(x_on==2) { x_on_char=value(0); x_times=value(0); } if(x_on==3) { x_off_char=value(0); x_times_x=value(0); } if(x_on>3) { x_on_char=17; x_off_char=19; x_times=1; x_times_x=1; } } /************ LEFT MOUSE BUTTON AS CR\LF ON OFF ****/ if(val==6) { /* 0= OFF 1=ON CR 2=ON CR\LF */ mouse_CR=value(0); } /********* X 7 left BLANK for now *******/ /******* X 8,from,to,times,delay: Color Rotation *******/ if(val==8) { v1=value(0); v2=value(0); v3=value(0); v4=value(0); if(v1==1 && v2==1 && v3==1 && v4==1) { /* store palette */ for(v5=0; v5<=15; v5++) vq_color(handle, v5, 0, previous_palette[v5]); } if(v1>15 || v1<0) v1=15; if(v2>15 || v2<0) v2=15; if(v3!=0 && v1!=v2) { /* don't rotate if times= 0 or from= to */ if(lp_flg!=1) xoff(); for(v6=0; v6<=v3; v6++) { if(v1=v1; v5--) { vq_color(handle,v5-1,0,rgb2); Vsync(); vs_color(handle,v5,rgb2); } Vsync(); vs_color(handle,v1,rgb); } if(v1>v2) { /* rotate left */ vq_color(handle,v2,0,rgb); for(v5=v2; v5<=v1; v5++) { vq_color(handle,v5+1,0,rgb2); Vsync(); vs_color(handle,v5,rgb2); } Vsync(); vs_color(handle,v1,rgb); } delay (v4); if(Bconstat(BC_CON)) {Bconin(BC_CON); v6=v3+1; } } /* next v6 */ if(lp_flg!=1) xon(); } if(v3==0) { /* restore previous palette */ for(v5=0; v5<=15; v5++) vs_color(handle,v5,previous_palette[v5]); } } /* end of X 8 routine */ } if(key=='?') { /* The INQUIRE command. */ val=value(0); while(Bcostat(BC_AUX)==0); if(val==0) { /* VERSION */ Bconout(BC_AUX,'2'); Bconout(BC_AUX,'.'); Bconout(BC_AUX,'1'); Bconout(BC_AUX,'7'); } if(val==1) { /* ? 1,mouse? CURSOR POSITION send X(column) & Y(row) & Mbutton back in ASCII character form,-32 offset to 0-79, 0-24, 0-3 */ v4=value(0); /* CURSOR MOVEMENT FROM MOUSE */ vq_mouse(handle,&butdown,&mx,&my); if(v4){ do { vq_mouse(handle,&butdown,&mx,&my); if(mxv2) Cconws("\33C"); if(myv3) Cconws("\33B"); p3=butdown; v2=mx; v3=my; } while(!p3); do { vq_mouse(handle,&v1,&v2,&v3); } while (v1); } vq_curaddress(handle,&p2,&p1); p3=butdown; p2+=31; p1+=31; p3+=32; Bconout(BC_AUX,p1); Bconout(BC_AUX,p2); Bconout(BC_AUX,p3); } if(val==2) { /* ? 2,x Send back mouse coordinates, button */ v4=value(0); vq_mouse(handle,&v1,&v2,&v3); if(v4) { /* poll the mouse */ vqm_attributes(handle,settings); vswr_mode(handle,3); i=0; points[0]=10000; points[1]=10000; do { vq_mouse(handle,&v1,&v2,&v3); if( points[0] != v2 || points[1] != v3) { if(i==1) v_pmarker(handle,1,points); points[0]=v2; points[1]=v3; i=1; v_pmarker(handle,1,points); } } while(!v1); /* don't exit till button released */ do vq_mouse(handle,&p1,&v2,&v3); while(p1); v_pmarker(handle,1,points); vswr_mode(handle,settings[3]); } /* make mouse values transmit in ascii */ v1+=48; v7=0; do { if(v2>9999) v2=9999; if(v7==1) v2=v3; if(v2>999) { v6=(v2/1000); Bconout(BC_AUX,v6+48); v2-=(v6*1000); if(v2<100) Bconout(BC_AUX,'0'); } if(v2>99) { v6=(v2/100); v6; Bconout(BC_AUX,v6+48); v2-=(v6*100); if(v2<10) Bconout(BC_AUX,'0'); } if(v2>9) { v6=(v2/10); Bconout(BC_AUX,v6+48); v2-=(v6*10); } if(v2>0) { v6=v2; Bconout(BC_AUX,v6+48); } else Bconout(BC_AUX,'0'); v7++; Bconout(BC_AUX,','); } while(v7<2); Bconout(BC_AUX,v1); Bconout(BC_AUX,':'); } if(val==3) { /* send the host the current rez */ i=Getrez(); i+=48; Bconout(BC_AUX,i); Bconout(BC_AUX,':'); } } if (key=='G') { /* Grab a piece of the screen. */ /* G to_screen_or_mem,mode,xs1,ys1,| xs2,ys2, | xd1,yd1 */ vq_extnd(handle,1,work_out); val=value(0); v7=value(0); v1=value(1); v2=value(2); if(val==2) { v3=(vd3-vd1)+v1; v4=(vd4-vd2)+v2; } if(val==1 || val==0 || val==3) { v3=value(1); v4=value(2); } if(val==0 || val==3) { /* if blit to screen get dest area */ v5=value(1); v6=value(2); } p1=Getrez(); if(p1>2) p1=0; /* Limit to ST modes */ if(p1==0) { if(v1>319) v1=319; if(v3>319) v3=319; if(v5>319) v5=319; } if(p1==0 || p1==1) { if(v2>199) v2=199; if(v4>199) v4=199; if(v6>199) v6=199; } if(p1==2) { if(v2>399) v2=399; if(v4>399) v4=399; if(v6>399) v6=399; } if(p1==1 || p1==2) { if(v1>639) v1=639; if(v3>639) v3=639; if(v5>639) v5=639; } pxy[0]=v1; pxy[4]=v1; pxy[1]=v2; pxy[5]=v2; pxy[2]=v3; pxy[6]=v3; pxy[3]=v4; pxy[7]=v4; if(val==1) { vd1=v1; vd2=v2; vd3=v3; vd4=v4; } if(val==2) { pxy[0]=vd1; pxy[1]=vd2; pxy[2]=vd3; pxy[3]=vd4; pxy[6]=(vd3-vd1)+v1; pxy[7]=(vd4-vd2)+v2; } /* from 0=screen to screen, 1=screen to mem, 2=mem to screen */ if(val>3) val=3; sourceMFDB.image=0L; destMFDB.image=bitblt_storage; destMFDB.width=vd3-vd1; destMFDB.height=vd4-vd2; destMFDB.wordw=((vd3-vd1)/16)+1; if(destMFDB.wordw>40) destMFDB.wordw=40; destMFDB.flag=0; destMFDB.planes=work_out[4]; if(val==0 || val==3) { /* set dest area for a blit to screen */ pxy[4]=v5; pxy[5]=v6; pxy[6]=(v3-v1)+v5; pxy[7]=(v4-v2)+v6; } if(v7>15) v7=3; /* set to replace mode if err */ for(i=0;i<8;i++) if(pxy[i]<0) pxy[i]=0; if(val==0) { destMFDB=sourceMFDB; vro_cpyfm(handle,v7,pxy,&sourceMFDB,&destMFDB); } if(val==1) vro_cpyfm(handle,v7,pxy,&sourceMFDB,&destMFDB); if(val==2 || val==3) vro_cpyfm(handle,v7,pxy,&destMFDB,&sourceMFDB); } if (key=='I') { /* I x INITIALIZE */ /* inits to what ever the attributes of the calling program or desktop were set to. */ /* x = 0 init pallet and attributes */ /* x = 1 init pallet ONLY */ /* x = 2 init attributes ONLY */ /* x = 3 inti IG default pallete */ val= value(0); if(val>3) val=0; if(val==0) { org_pallet(); reset_attributes(); } if(val==1) org_pallet(); if(val==2) reset_attributes(); if(val==3) for(val=0; val<16; val++) vs_color(handle,val,sys_color[val] ); } if (key=='A') { /* A t p b fill ATTRIBUTES */ /* t=type (0-3) 0=hollow 1=solid 2=pattern 3=hatch */ /* p=pattern (1-24) works only with pattern & hatch types */ /* b=border 0=no border any other value yields a border */ val= value(0); p1= value(0); p2= value(0); if (val>3) val=0; vsf_interior(handle,val); vsf_style(handle,p1); vsf_perimeter(handle,p2); } if (key=='B') { /* B tlx tly brx bry r BAR (rectangle) filled */ /* tl=topleft corner x y cords. */ /* br=bottom right x y cords. */ /* r=rounded corners? (1=yes 0=no) */ sides[0]= value(1); sides[1]= value(2); sides[2]= value(1); sides[3]= value(2); val= value(0); if ( ! val ) v_bar(handle,sides); if ( val ) v_rfbox(handle,sides); } if (key=='C') { /* C x pen -set polymarker, line, fill */ /* and "WRITTEN" text color */ /* where x=(0-4) 0=marker 1=line 2=fill 3=text */ /* pen = (0 - 15) VDI pen not color register */ p1= value(0); val= value(0); if (val>15) val=0; if (p1>3) p1=0; if(p1==0) vsm_color(handle,val); if(p1==1) vsl_color(handle,val); if(p1==2) vsf_color(handle,val); if(p1==3) vst_color(handle,val); } if (key=='D') { /* D x y DRAWTO */ /* use P x y to set starting point and be sure */ /* type is T 1 1 1 if you want a pixel point */ lines[0]=lines[2]; lines[1]=lines[3]; lines[2]= value(1); lines[3]= value(2); v_pline(handle,2,lines); lines[0]=lines[2]; lines[1]=lines[3]; } if (key=='E') { /* E font size rotation EFFECTS for "WRITTEN" text */ /* font(1,2,4,8,16) size(8,9,10,16,18,20 (in points 1/72") */ /* rotation (0-4) = *90 degrees */ p1= value(0); p2= value(0); p3= value(0); vst_effects(handle,p1); if (p3>4) p3=0; p3 *=900; vst_rotation(handle,p3); if (p2<8) p2=8; if (p2>20) p2=20; vst_point(handle,p2,&p1,&p3,&v1,&v2); } if (key=='F') { /* F x y FLOOD FILL color replace mode */ p1=value(1); p2=value(2); if(lp_flg!=1) xoff(); v_contourfill(handle,p1,p2,-1); if(lp_flg!=1) xon(); } if (key=='H') { /* H x HOLLOW ( frames ) */ /* x=1 on x=0 off */ val= value(0); if ( val>1 ) val=1; if ( val==1 ) { vsf_interior(handle,0); vswr_mode(handle,2); vsf_perimeter(handle,1); } if ( val == 0 ) { vsf_interior(handle,1); vswr_mode(handle,1); vsf_perimeter(handle,0); } } if (key=='J') { /* J x y xradius yradius begin_angle end_angle */ /* ELLIPTICAL ARC */ p1= value(1); p2= value(2); p3= value(1); v1= value(2); v2= value(0); v3= value(0); v2 *= 10; v3 *= 10; v_ellarc(handle,p1,p2,p3,v1,v2,v3); } if (key=='K') { /* K x y radius begin_angle end_angle ARC */ p1= value(1); p2= value(2); p3= value(1); v1= value(0); v2= value(0); v1 *= 10; v2 *= 10; v_arc(handle,p1,p2,p3,v1,v2); } if (key=='Z') { /* Z x_up_left y_up_left x_low_right y_low_right */ /* FILLED RECTANGLE */ sides[0]= value(1); sides[1]= value(2); sides[2]= value(1); sides[3]= value(2); vr_recfl(handle,sides); } if (key=='U') { /* U left_edge top_edge right_edge bottom_edge fill_flag */ /* ROUNDED RECTANGLE */ sides[0]= value(1); sides[1]= value(2); sides[2]= value(1); sides[3]= value(2); val= value(0); if (val==0) v_rbox(handle,sides); if (val>0 ) v_rfbox(handle,sides); } if (key=='L') { /* L x y xEND yEND draw a line */ lines[0]= value(1); lines[1]= value(2); lines[2]= value(1); lines[3]= value(2); v_pline(handle, 2, lines); } if (key=='M') { /* M x graphics drawing MODE */ /* 1=replace, 2=Transparent, 3=XOR, 4=reverse transparent */ val= value(0); if (val<1 || val>4) val=1; vswr_mode(handle,val); } if (key=='g') { /* g x Set graphics scaling coordinates */ val= value(0); if (val<0 || val>2) val=0; g_s=val; g_res=Getrez(); } if (key=='O') { /* O x y radius CIRCLE */ p1= value(1); p2= value(2); p3= value(1); v_circle(handle,p1,p2,p3); } if (key=='P') { /* P x y polymarker plot */ points[0]= value(1); points[1]= value(2); v_pmarker(handle,1,points); lines[2]=points[0]; lines[3]=points[1]; } if (key=='Q') { /* Q x y xradius yradius OVAL (ellipse) */ p1= value(1); p2= value(2); p3= value(1); val= value(2); v_ellipse(handle,p1,p2,p3,val); } if (key=='R') { /* R x p set resolution 0-1 sys pallete 0-2 */ val= value(0); p1= value(0); rez=Getrez(); if ( val< 0 || val>1 ) val=rez; if (rez != 2 && rez!=val) { if(val==0) rez_change_low(); if(val==1) rez_change_med(); } /* Setscreen(-1L,-1L,val); */ clip_set(); if( p1==2 ) for(val=0; val<16; val++) vs_color(handle,val,sys_color[val]); if( p1==1 ) for(p1=0; p1<16; p1++) vs_color(handle,p1,org_color[p1]); } if (key=='S') { /* S pen red green blue pen(0-15) rgb(0-7) */ /* SET PEN COLOR */ val= value(0); rgb[0]= value(0); rgb[1]= value(0); rgb[2]= value(0); if (val>15) val=0; for(p1=0; p1<3; p1++) { p2=rgb[p1]; switch(p2) { case 1: rgb[p1]=142; break; case 2: rgb[p1]=285; break; case 3: rgb[p1]=428; break; case 4: rgb[p1]=571; break; case 5: rgb[p1]=714; break; case 6: rgb[p1]=857; break; case 7: rgb[p1]=1000; break; default: rgb[p1]=0; break; } } vs_color(handle,val,rgb); } if (key=='T') { /* type of polymarker(1-6) and height(y*11) y=(1-8) */ /* type of line(1-6) and thickness(1-40) */ /* 1 for marker 2 for line */ /* G#T 1 3 8 marker G#T 2 1 40 line */ /* T 2 1 50 (to 54) arrowhead endlines */ /* T 2 1 60 (to 64) rounded endlines */ /* T 2 1 0 square endlines */ p1= value(0); if ( p1<1 || p1>2 ) break; p2= value(0); if ( p2<1 || p2>6 ) p2=1; if ( p1 == 1 ) { p3= value(0); if (p3<1 || p3>8 ) p3=1; vsm_type(handle,p2); vsm_height(handle,p3*11); } if (p1==2) { p3= value(0); if (p3<42 && p3>0) { if (p2>1) p3=1; vsl_type(handle,p2); vsl_width(handle,p3); } if (p3==0) vsl_ends(handle,0,0); if (p3==50) vsl_ends(handle,1,1); if (p3==51) vsl_ends(handle,1,0); if (p3==52) vsl_ends(handle,0,1); if (p3==53) vsl_ends(handle,1,2); if (p3==54) vsl_ends(handle,2,1); if (p3==60) vsl_ends(handle,2,2); if (p3==61) vsl_ends(handle,2,0); if (p3==62) vsl_ends(handle,0,2); if (p3==63) vsl_ends(handle,2,1); if (p3==64) vsl_ends(handle,1,2); } } if (key=='V') { /* V x y radius beginangle endangle PIESLICE */ p1= value(1); p2= value(2); p3= value(1); v1= value(0); v2= value(0); v1 *=10; v2 *=10; v_pieslice(handle,p1,p2,p3,v1,v2); } if (key=='W') { /* W x y string "WRITE" text to x y coord. */ p1= value(1); p2= value(2); get_text(); v_gtext(handle,p1,p2,text); } if (key=='Y') { /* Y x y xradius yradius beginangle endangle OVAL-PIESLICE */ p1= value(1); p2= value(2); p3= value(1); v1= value(2); v2= value(0); v3= value(0); v2 *=10; v3 *=10; v_ellpie(handle,p1,p2,p3,v1,v2,v3); } if(key=='n') { /* n, play_note */ /* Musical Note Routine has 6 parameters p1-p6 */ /* 1 = effect number(0-19) 2 = voice number(0-2) */ /* 3 = volume(0-15) 4 = pitch(0-255) */ /* 5 = pause in 200ths sec (0-9999) */ /* 6 = stop sotnd type (0-4) */ v1=value(0); v2=value(0); v3=value(0); v4=value(0); v5=value(0); v6=value(0); play_note(v1,v2,v3,v4,v5,v6); } if (key=='t') { /* t x TIME */ /* pause BBS by sending a cntrl-s and time it for x seconds */ /* then send a ctrl-q 30 second max */ val= value(0); if(val>30) val=30; timer1 = clock1(); if(lp_flg!=1) xoff(); do { timer2 = clock1(); if(Bconstat(BC_CON)(BC_CON)(BC_CON)(BC_CON)(BC_CON) /* br=bottom right x y cords. */ /* r=rounded corners? (1=yes 0=no) */ sides[0]= value(1); sides[1]= value(2); sides[2]= value(1); sides[3]= value(2); val= value(0); if ( ! val ) v_bar(handle,sides); if ( val ) v_rfbox(handle,sides); } if (key=='C') { /* C x pen -set polymarker, line, fill */ /* and "WRITTEN" text color */ /* where x=(0-4) 0=marker 1=line 2=fill 3=text */ /* pen = (0 - 15) VDI pen not color register */ p1= value(0); val= value(0); if (val>15) val=0; if (p1>3) p1=0; if(p1==0) vsm_color(handle,val); if(p1==1) vsl_color(handle,val); if(p1==2) vsf_color(handle,val); if(p1==3) vst_color(handle,val); } if (key=='D') { /* D x y DRAWTO */ /* use P x y to set starting point and be sure */ /* type is T 1 1 1 if you want a pixel point */ lines[0]=lines[2]; lines[1]=lines[3]; lines[2]= value(1); lines[3]= value(2); v_pline(handle,2,lines); lines[0]=lines[2]; lines[1]=lines[3]; } if (key=='E') { /* E font size rotation EFFECTS for "WRITTEN" text */ /* font(1,2,4,8,16) size(8,9,10,16,18,20 (in points 1/72") */ /* rotation (0-4) = *90 degrees */ p1= value(0); p2= value(0); p3= value(0); vst_effects(handle,p1); if (p3>4) p3=0; p3 *=900; vst_rotation(handle,p3); if (p2<8) p2=8; if (p2>20) p2=20; vst_point(handle,p2,&p1,&p3,&v1,&v2); } if (key=='F') { /* F x y FLOOD FILL color replace mode */ p1=value(1); p2=value(2); if(lp_flg!=1) xoff(); v_contourfill(handle,p1,p2,-1); if(lp_flg!=1) xon(); } if (key=='H') { /* H x HOLLOW ( frames ) */ /* x=1 on x=0 off */ val= value(0); if ( val>1 ) val=1; if ( val==1 ) { vsf_interior(handle,0); vswr_mode(handle,2); vsf_perimeter(handle,1); } if ( val == 0 ) { vsf_interior(handle,1); vswr_mode(handle,1); vsf_perimeter(handle,0); } } if (key=='J') { /* J x y xradius yradius begin_angle end_angle */ /* ELLIPTICAL ARC */ p1= value(1); p2= value(2); p3= value(1); v1= value(2); v2= value(0); v3= value(0); v2 *= 10; v3 *= 10; v_ellarc(handle,p1,p2,p3,v1,v2,v3); } if (key=='K') { /* K x y radius begin_angle end_angle ARC */ p1= value(1); p2= value(2); p3= value(1); v1= value(0); v2= value(0); v1 *= 10; v2 *= 10; v_arc(handle,p1,p2,p3,v1,v2); } if (key=='Z') { /* Z x_up_left y_up_left x_low_right y_low_right */ /* FILLED RECTANGLE */ sides[0]= value(1); sides[1]= value(2); sides[2]= value(1); sides[3]= value(2); vr_recfl(handle,sides); } if (key=='U') { /* U left_edge top_edge right_edge bottom_edge fill_flag */ /* ROUNDED RECTANGLE */ sides[0]= value(1); sides[1]= value(2); sides[2]= value(1); sides[3]= value(2); val= value(0); if (val==0) v_rbsnd_ele++) { switch(snd_num) { case 0: aa[snd_ele]=snd_patches[0][snd_ele]; break; case 1: ab[snd_ele]=snd_patches[1][snd_ele]; break; case 2: ac[snd_ele]=snd_patches[2][snd_ele]; break; case 3: ad[snd_ele]=snd_patches[3][snd_ele]; break; case 4: ae[snd_ele]=snd_patches[4][snd_ele]; break; case 5: af[snd_ele]=snd_patches[5][snd_ele]; break; case 6: ag[snd_ele]=snd_patches[6][snd_ele]; break; case 7: ah[snd_ele]=snd_patches[7][snd_ele]; break; case 8: ai[snd_ele]=snd_patches[8][snd_ele]; break; case 9: aj[snd_ele]=snd_patches[9][snd_ele]; break; case 10: ak[snd_ele]=snd_patches[10][snd_ele]; break; case 11: al[snd_ele]=snd_patches[11][snd_ele]; break; case 12: am[snd_ele]=snd_patches[12][snd_ele]; break; case 13: an[snd_ele]=snd_patches[13][snd_ele]; break; case 14: ao[snd_ele]=snd_patches[14][snd_ele]; break; case 15: ap[snd_ele]=snd_patches[15][snd_ele]; break; case 16: aq[snd_ele]=snd_patches[16][snd_ele]; break; case 17: ar[snd_ele]=snd_patches[17][snd_ele]; break; case 18: as[snd_ele]=snd_patches[18][snd_ele]; break; case 19: landing[snd_ele]=snd_patches[19][snd_ele]; break; } /* end switch */ } /* end for */ } /* endif val==22 */ } if(key=='i') { /* i x t LINE INSERTS */ /* x (0-1) 0= cursor up insert blanks if at top of screen */ /* x (0-1) 1= insert line at cursor, bottom line is scrolled off */ /* t = number of times to do this. */ val= value(0); p1= value(0); if(val>1) val=0; p2=0; do { Bconout(2,27); if(val==0) Bconout(2,'I'); if(val==1) Bconout(2,'L'); p2 ++; } while(p21) val=0; Bconout(2,27); if(val==0) Bconout(2,'j'); if(val==1) Bconout(2,'k'); } if(key=='d') { /* d x DELETE LINE scroll screen up a line at bottom. */ /* x = number of lines to delete */ val= value(0); p2=0; do { Bconout(2,27); Bconout(2,'M'); p2 ++; } while(p2 cursor */ /* x=1 clear line from begining to cursor inclusive */ /* x=2 clear at cursor to end of line */ val= value(0); if(val>2) val=0; Bconout(2,27); if(val==0) Bconout(2,'l'); if(val==1) Bconout(2,'o'); if(val==2) Bconout(2,'K'); } if(key=='s') { /* s x SCREEN CLEARS */ /* where x=0 clear whole screen home cursor */ /* x=1 clear from home to cursor */ /* x=2 clear from cursor to bottom of screen */ /* x=3 clear whole screen with VDI */ /* x=4 clear with VDI & VT52 */ /* x=5 reverse off, background to 0, char color 3, clear & home */ val= value(0); if(val>5) val=0; if(val!=3) { Bconout(2,27); if(val==0 || val==4) Bconout(2,'E'); if(val==1) Bconout(2,'d'); if(val==2) Bconout(2,'J'); if(val==5) Cconws("\33q\33c0\33b3\33E"); } if(val==3 || val==4) v_clrwk(handle); } if(key=='p') { /* p column row POSITION CURSOR x y */ /* this is reverse to normal operation */ /* reason is everything else is X Y */ /* why not cursor positioning? */ p1= value(0); p2= value(0); p1+=32; p2+=32; Bconout(2,27); Bconout(2,'Y'); Bconout(2,p2); Bconout(2,p1); } if(key=='c') { /* c f x printed TEXT COLOR */ /* f=0 set background f=1 set text color */ /* x = color register */ p1= value(0); p2= value(0); if(p1>1) p1=0; Bconout(2,27); if(p1==0) { Bconout(2,'c'); Bconout(2,p2); } if(p1==1) { Bconout(2,'b'); Bconout(2,p2); } } if(key=='v') { /* v x VIDEO (inverse on/off) */ /* where x=0 off x=1 on */ val= value(0); if(val>1) val=0; Bconout(2,27); if(val==0) Bconout(2,'q'); if(val==1) Bconout(2,'p'); } if(key=='k') { /* k x CURSOR ( on/off ) and Destructive Backspace */ /* where x=0 off x=1 on */ /* x=2 destructive backspace on, x=3 destruction off */ val=value(0); if(val>3) val=0; if(val<2) Bconout(2,27); if(val==0) Bconout(2,'f'); if(val==1) Bconout(2,'e'); if(val==2) des_backsp=1; if(val==3) des_backsp=0; } if(key=='w') { /* w x LINE WRAP ( on/off ) */ /* where x=0 off x=1 on */ val= value(0); if(val>1) val=0; Bconout(2,27); if(val==0) Bconout(2,'w'); if(val==1) Bconout(2,'v'); } } while(lp_flg==1 && bad_cmd !=0 ); /* end do '&' command */ if(did_loop==1) { did_loop=0; xon(); } lp_type=' '; is_gang='X'; /* zero @ option & LOOP; null gang */ } while ( chain == '>' ); if(mem_key_flg) { mem_key_flg=0; for(v1=1;v14 ) { recieving=0; Bconout(BC_CON,7); } } bad_cmd=1; } /***********/ value(x_y) int x_y; { float scale_ratio,round; int num,v1,v2,v3,v4,ct,flg,key,recieving,x_screen,y_screen,plus_minus_flg; unsigned long timer1, timer2,t1,t2; num=0; v1=0, v2=0, v3=0, v4=0, ct=0, flg=0, plus_minus_flg=0; if(lp_flg==0) { v_jmp: do { recieving=1; timer1 = clock1(); while (recieving) { timer2 = clock1(); if (Bconstat(BC_AUX)) { key = Bconin(BC_AUX); recieving=0; } /* time out in 5 seconds */ if ( ((timer2/CLK_TCK)-(timer1/CLK_TCK)) > 4 ) { recieving=0; num=0; key=0; Bconout(BC_CON,7); } } if (key<48 || key>57) flg=1; else { ct++; switch(ct) { case 1: v1=key-48; break; case 2: v2=key-48; break; case 3: v3=key-48; break; case 4: v4=key-48; break; default: num=0; } } } while ( flg == 0 ); switch(ct) { case 4: v3*=10; v2*=100; v1*=1000; num=v4+v3+v2+v1; break; case 3: v2*=10; v1*=100; num=v3+v2+v1; break; case 2: v1*=10; num=v2+v1; break; case 1: num=v1; break; default: num=0; } if(g_s && x_y>0 && num>0) { /* If scaling set and desired do it! */ if(g_s!=2) { if((g_res==2 || g_res==1) && x_y==1) x_screen=639; if(g_res==2 && x_y==2) y_screen=399; if((g_res==1 || g_res==0) && x_y==2) y_screen=199; if(g_res==0 && x_y==1) x_screen=319; scale_ratio=9999/num; if(x_y==1) round=x_screen/scale_ratio; if(x_y==2) round=y_screen/scale_ratio; if(round-(int)round> .49) num=(int)round+1; if(round-(int)round< .5) num=(int)round; } /* g 2: option */ if(g_s==2 && x_y==2 && g_res==2) num*=2; } if(key=='_') { key=get_aux_char(); key=get_aux_char(); flg=0; goto v_jmp; } if(key==120) { num= -32767; key=get_aux_char(); } if(key==121) { num= -32766; key=get_aux_char(); } if(key=='r') { num= -32765; key=get_aux_char(); } /**** ,+CONSTANT,-CONSTANT, !CONSTANT ****/ if(key=='+') { plus_minus_flg=1; flg=0; goto v_jmp; } if(key=='-') { plus_minus_flg=2; flg=0; goto v_jmp; } if(key=='!') { plus_minus_flg=3; flg=0; goto v_jmp; } if(plus_minus_flg==1) num= 0-num; if(plus_minus_flg==2) num= 0-10000-num; if(plus_minus_flg==3) num= 0-20000-num; } /* endif lp_flg */ if(lp_flg==1) { if (lp_eff_ct==0) lp_x=0; if(lp_eff_ct==0) { t1=clock1(); do { t2=clock1(); if(Bconstat(BC_CON)) break; } while (t2-t1 -30000 && lp_effect[lp_eff_ct]<0)) { lp_x++; if(lp_2nd==0) lp_was=lp1; if(lp_x<2 && lp_1st!=0) { lp1+=lp3; lp_2nd++; if(lp_2nd==1 && lp_type=='|') lp1=lp_was; if(lp_2nd==2 && lp_type=='|') lp_2nd=0; } if(lp_effect[lp_eff_ct]< -29999) num=lp1; lp_1st++; if(lp_effect[lp_eff_ct]== -32766) { if(lp5lp2) num=lp5-lp1; if(lp5==lp2) num=0; } /* +CONSTANT =Step+CONSTANT */ if(num<0 && num> -10000) num=abs(num)+lp1; /* -CONSTANT =Step-CONSTANT */ if(num< -9999 && num> -20000) { num+=10000; num=abs(num); num=lp1-num; } /* !CONSTANT = CONSTANT-Step */ if(num< -19999 && num> -30000) { num+=20000; num=abs(num); num-=lp1; } } /* Check for CTRL-C from user to abort LOOP */ if (Bconstat(BC_CON)) { key = Bconin(BC_CON); if (key == 3 || key==24) lp_flg=0; } if(lp_no_prams==1 && lp_eff_ct==0) lp1+=lp3; if(lp3>=1 && lp1>=lp2 && lp_eff_ct==(lp_num_prams-1)) lp_flg=0; if(lp3<0 && lp1<=lp2 && lp_eff_ct==(lp_num_prams-1)) lp_flg=0; if(lp_type!='@' && lp_flg==0 && lp_com=='W') lp_type='Z'; lp_eff_ct++; if(lp_eff_ct>=lp_num_prams) lp_eff_ct=0; } if(num== -32765 && r_lp==0) num=r_random(); bad_cmd=1; return(num); } /*************/ clip_set() { int rez; rez = Getrez(); if ( rez = 0 ) set_clip(0,0,319,199); if ( rez = 1 ) set_clip(0,0,639,199); if ( rez = 2 ) set_clip(0,0,639,399); } /************/ set_baud() { int x, b; Cconws("\33E \33p SET BAUD \33q"); Cconws("\n\r Note: not tested past 2400 baud"); Cconws("\n\n\r [\33p1\33q] 300"); Cconws("\n\r [\33p2\33q] 1200"); Cconws("\n\r [\33p3\33q] 2400"); Cconws("\n\r [\33p4\33q] 4800"); Cconws("\n\r [\33p5\33q] 9600"); Cconws("\n\n\r Select > "); do { x=Bconin(2); } while( x< '1' || x> '5'); if(x=='1') b=9; if(x=='2') b=7; if(x=='3') b=4; if(x=='4') b=2; if(x=='5') b=1; Rsconf(b,-1,-1,-1,-1,-1); Cconws("\33E"); } /*****************/ org_pallet() { int reg; /**** set original color palette ****/ reg=0; do { vs_color(handle,reg, org_color[reg] ); reg++; } while (reg != 16); } /************/ file_find() { /* search for filename return long length, filename is a global */ int i; long saved; struct { char reserved[21]; char fattr; int ftime; int fdate; unsigned long fsize; char fname[14]; } dumb; Cconws("\n\n\rExample a:"); Bconout(BC_CON,92); Cconws("best.ig"); Cconws("\n\rEnter path and filename: "); filename[0] = 128; for(i=1;i<129;i++) filename[i]=' '; filename[129]='\0'; Cconrs(filename); if(help==2) Cconws("\33E"); saved = Fgetdta(); Fsetdta(&dumb); if (Fsfirst(&filename[2],0x10) == 0 ) { num_bytes = dumb.fsize; } else { num_bytes=0; } if (num_bytes==0) Cconws("\n\n\rFile not found!\n\r"); } /**************/ read_file( ) { unsigned long int x2; if ( bytes_left > 0 ) { if (bytes_left <= 4096L) { x2 = Fread(filehandle,bytes_left,filebuffer); if (x2 != bytes_left ) Cconws("\n\n\rError reading file!"); } if (bytes_left > 4096L) { x2 = Fread(filehandle,4096L,filebuffer); if (x2 != 4096L) Cconws("\n\n\rError reading file!"); } bytes_read = x2; bytes_left -= x2; } } /*****************/ display_file() { int flag, u; flag=5; f_ct=0; bytes_parsed=0; read_file(); do { if ( f_ct == 4096 ) { f_ct=0; read_file(); } if((flag==0 && filebuffer[f_ct] !='#') || (flag==0 && help) ) { Bconout(BC_CON,'G'); if(filebuffer[f_ct] !='G') Bconout(BC_CON,filebuffer[f_ct]); } if( flag != 0 && filebuffer[f_ct] !='G') Bconout(BC_CON,filebuffer[f_ct]); f_key = filebuffer[f_ct]; bytes_parsed ++; f_ct ++; flag++; if ( flag > 30000 ) flag=5; if (f_key =='G') flag=0; if ( f_key =='#' && flag == 1 && !help ) { f_ct --; bytes_parsed --; do_file_graphics(); f_ct ++; bytes_parsed ++; } if (Bconstat(BC_CON)) { u = Bconin(BC_CON); if (u==19) { do { if(Bconstat(BC_CON)) u=Bconin(BC_CON); } while (u != 17 ); } if ( u==3 ) bytes_parsed=file_length+1; } } while ( bytes_parsed < file_length ); } /*******************/ do_file_graphics() { int points[2], sides[4], rgb[3], rgb2[3]; static int current_palette[16] [3], previous_palette[16] [3]; int key, chain, rez, i, lp_ct; int p1, p2, p3, val, v1, v2, v3, tries, out_of_range; int v4,v5,v6,v7,pxy[8],settings[4],snd_num,snd_ele,*w2; unsigned char rx, ry, is_gang='X', chain_gang[132]; unsigned long clock_t, timer1, timer2, rd; do { key = get_char(); chain = get_char(); if (key && chain) { /** else it's the end of the file **/ if (key=='&') { /*** LooP command settings ***/ /* & From,To,Step,Delay,COMMAND(, or |=Xor @=get_text)num_prams,x,x,const */ lp_flg=0; lp1=f_value(0); lp2=f_value(0); lp3=f_value(0); lp4=f_value(0); if(lp1>lp2){ lp_ct=lp3; lp3=0-lp_ct; } if(lp3==0) lp3=1; key=get_char(); lp_com=is_gang=key; if(is_gang=='>') { f_get_text(); for(v1=0; v1<128; v1++) chain_gang[v1]=text[v1]; } lp_type=get_char(); lp_num_prams=f_value(0); if (lp_num_prams<1) lp_num_prams=1; if(lp_num_prams>2048) lp_num_prams=2048; lp_flg=0; /* 1st pass set array flags */ lp5=lp1; r_lp=1; /* set random flg make flgs for rnd in array */ for(lp_ct=0;lp_ct -30000 && lp_effect[lp_ct]<0)) lp_no_prams=0; } } do { /** do Loop for the '&' command **/ bad_cmd=0; if(is_gang=='>') { v1=f_value(0); if(v1<0 || v1>127) v1=0; key=lp_com=chain_gang[v1]; } /******Graphics commands section ******/ if(key=='<') { /* GET_KEY_TRAN < x,y,z: x=0 tran key only x=1 tran with CR y=0 hot key input y=1 CR required y=2 MOUSE ZONE z= output choice to screen? 1=yes 0=no 2=yes toss, 3=no toss <- if toss no transmit anything. GET a keys remember till chain is broke then transmit to host. */ mem_key_cr=f_value(0); val=f_value(0); v5=f_value(0); mem_key_flg=1; mem_key_ct=0; if(v5==2) mem_key_flg=0; if(v5==3) { v5=0; mem_key_flg=0; } do { if(val!=2) { v4=Bconin(BC_CON); if(v4==127 || v4==8 && mem_key_ct>0) mem_key_ct--; if(v4>31 && v4<127) { if(mem_key_ct<129) { mem_key_ct++; mem_key[mem_key_ct]=v4; if(v5) Bconout(BC_CON,mem_key[mem_key_ct]); } } if(v5 && v4==127 || v4==8) { Bconout(BC_CON,27); Bconout(BC_CON,'D'); Bconout(BC_CON,' '); Bconout(BC_CON,27); Bconout(BC_CON,'D'); } if(v4==13) val=0; } /* endif (val!=2) */ /************************************/ if(val==2) { /* MOUSE ZONE for POINT and CLICK */ /* part of the "<" command. */ zone_jmp: vq_mouse(handle,&v1,&v2,&v3); /* poll the mouse */ vqm_attributes(handle,settings); vswr_mode(handle,3); i=0; points[0]=10000; points[1]=10000; do { vq_mouse(handle,&v1,&v2,&v3); if( points[0] != v2 || points[1] != v3) { if(i==1) v_pmarker(handle,1,points); points[0]=v2; points[1]=v3; i=1; v_pmarker(handle,1,points); } } while(!v1); /* don't exit till button released */ do vq_mouse(handle,&p1,&p2,&p3); while(p1); v_pmarker(handle,1,points); vswr_mode(handle,settings[3]); v7=1; if(zone_loopback) v7=2; for(i=0;i<=47;i++) { if(v2>=zone[i][0] && v2<=zone[i][2] && v3>=zone[i][1] && v3<=zone[i][3] ) { v7=0; break; } } if(v7==1) i=47; /* default to last zone */ if(v7==2) { Bconout(BC_CON,7); goto zone_jmp; } mem_key_ct=zone_cmds[i][0]; for(v6=1;v60); } if(key=='N') { /* NOISE N x,num_bytes */ /* x=0 load midi buff */ /* x=1 load and execute */ /* x=2 execute buff, NO num_bytes given */ /* x=3 load buff for CHIP */ /* x=4 load buff for chip and exe */ /* x=5 exe buff with chip commands */ val=f_value(0); if(val==2 || val==5) v1=midi_len; if(val!=2 && val!=5) { v1=f_value(0); midi_len=v1; for(p1=0;p12) { p3=midi_on; midi_on=0; } } if(midi_on && val<3) { for(p2=1;p210000) p2=10000; while(!Bcostat(3)); v2=ig_midi[p2-1]; /* MIDI out */ Bconout(3,v2); timer1=clock1(); /* do timing */ while(clock1()-timer12) midi_on=p3; if(val==4 || val==5 && v1>5) { for(p1=0;p110000) p1=10000; play_note(ig_midi[p1],ig_midi[p1+1],ig_midi[p1+2],ig_midi[p1+3],ig_midi[p1+4],ig_midi[p1+5]); } } } if (key=='X') { /* extended commands section */ /* extended commands are identified by a X and a number value 0 thru 9999. This allows 10,000 new commands to be introduced. use the lower case x for adding your own extended commands. */ val=f_value(0); /*----------------------------------------------------------------------------*/ /* 0, left_x,left_y, range_x,range_y, num_dots spray paint */ /* the ranges can only be 0 thru 255 */ if(val==0) { p1=f_value(1); p2=f_value(2); v1=f_value(1); v2=f_value(2); v3=f_value(0); for(p3=0;p3v1) { out_of_range=1; rd=Random(); rx=(char)rd; } if(ry>v2) { out_of_range=1; rd=Random(); ry=(char)rd; } if(tries>8) { out_of_range=0; rx=0; ry=0; } } while(out_of_range); points[0]=p1+rx; points[1]=p2+ry; v_pmarker(handle,1,points); } } /***** end of spray paint *****/ /***************************Setcolor register**************************/ /* X 1,register,value register 0-15 value 0-1911 */ if(val==1) { /* Setcolor register with Xbios */ /* Allow changing of registers without using VDI */ p1=f_value(0); p2=f_value(0); if(p1>15) p1=15; /* if(p2>1911) p2=1911; Kill may allow 4096 colors */ Setcolor(p1,p2); } /******** Set RANDOM from to range *******/ /* X 2,from,to */ if(val==2) { rnd_f=f_value(0); rnd_t=f_value(0); if(rnd_f<0) rnd_f=0; if(rnd_t2) v1=0; if(v1==0) x_r_but=0; /* X 3,OFF? */ if(v1==1) { /* X 3,ON,CR? */ x_r_but=1; r_but_tran[81]=f_value(0); } if(v1==2) { /*X 3,2,ON,CR?,string len,string */ v4=f_value(0); if(v4==0) x_r_but=0; else x_r_but=1; r_but_tran[81]=f_value(0); r_but_tran[0]=f_value(0); if(r_but_tran[0]>80) r_but_tran[0]=80; if(r_but_tran[0]<1) r_but_tran[0]=1; for(v2=1;v2<=r_but_tran[0];v2++) r_but_tran[v2]=get_char(); v3=get_char(); /* dead get for seperator */ } } /************ LOAD ZONE DATA FOR POINT & CLICK *******/ if(val==4) { /* zone_num,up_left_x,up_left_y, lower_right_x,lower_right_y, cmd_string_len,cmd_string: */ v1=f_value(0); if(v1>47 && v1!=9999 && v1!=9998 && v1!=9997) v1=47; /* zone_num */ /* if X 4,9999: zero zones */ if(v1==9999) for(p1=0;p1<48;p1++) { zone[p1][0]=-1; zone[p1][1]=-1; zone[p1][2]=-1; zone[p1][3]=-1; } /* if X 4,9998: SET ZONE loopback on invalid selection */ if(v1==9998) zone_loopback=1; /*ON*/ if(v1==9997) zone_loopback=0; /*OFF*/ if(v1<9997) { zone[v1][0]=f_value(1); /* up_left_x */ zone[v1][1]=f_value(2); /* up_left_y */ zone[v1][2]=f_value(1); /* lower_right_x */ zone[v1][3]=f_value(2); /* lower_right_y */ v2=f_value(0); if(v2>80) v2=80; /* cmd_string_len */ if(v2<1) v2=1; zone_cmds[v1][0]=v2; for(v3=1;v3<=zone_cmds[v1][0];v3++) zone_cmds[v1][v3]=get_char(); v4=get_char(); /* dead get for seperator */ } /* endif v1<9997 */ } /************ XON XOFF shutdown ***************/ if(val==5) { /* 0=off 1=on */ /* 2=set xon xtimes */ /* 3=set xoff xtimes*/ x_on=f_value(0); if(lp_flg) x_on=1; if(x_on==2) { x_on_char=f_value(0); x_times=f_value(0); } if(x_on==3) { x_off_char=f_value(0); x_times_x=f_value(0); } if(x_on>3) { x_on_char=17; x_off_char=19; x_times=1; x_times_x=1; } } /************ LEFT MOUSE BUTTON AS CR\LF ON OFF ****/ if(val==6) { /* 0= OFF 1=ON CR 2=ON CR\LF */ mouse_CR=f_value(0); } /****** X 7 left BLANK for now ******/ /******* X 8,from,to,times,delay: Color Rotation *******/ if(val==8) { v1=f_value(0); v2=f_value(0); v3=f_value(0); v4=f_value(0); if(v1==1 && v2==1 && v3==1 && v4==1) { /* store palette */ for(v5=0; v5<=15; v5++) vq_color(handle, v5, 0, previous_palette[v5]); } if(v1>15 || v1<0) v1=15; if(v2>15 || v2<0) v2=15; if(v3!=0 && v1!=v2) { /* don't rotate if times= 0 or from= to */ for(v6=0; v6<=v3; v6++) { if(v1=v1; v5--) { vq_color(handle,v5-1,0,rgb2); Vsync(); vs_color(handle,v5,rgb2); } Vsync(); vs_color(handle,v1,rgb); } if(v1>v2) { /* rotate left */ vq_color(handle,v2,0,rgb); for(v5=v2; v5<=v1; v5++) { vq_color(handle,v5+1,0,rgb2); Vsync(); vs_color(handle,v5,rgb2); } Vsync(); vs_color(handle,v1,rgb); } delay (v4); if(Bconstat(BC_CON)) {Bconin(BC_CON); v6=v3+1; } } /* next v6 */ } if(v3==0) { /* restore previous palette */ for(v5=0; v5<=15; v5++) vs_color(handle,v5,previous_palette[v5]); } } /* end of X 8 routine */ } if(key=='?') { /* The INQUIRE command. */ val=f_value(0); while(Bcostat(BC_AUX)==0); if(val==0) { /* VERSION */ Bconout(BC_AUX,'2'); Bconout(BC_AUX,'.'); Bconout(BC_AUX,'1'); Bconout(BC_AUX,'7'); } if(val==1) { /* ? 1,mouse? CURSOR POSITION send X(column) & Y(row) & Mbutton back in ASCII character form,-32 offset to 0-79, 0-24, 0-3 */ v4=f_value(0); /* CURSOR MOVEMENT FROM MOUSE if 2nd pram set*/ vq_mouse(handle,&butdown,&mx,&my); if(v4){ do { vq_mouse(handle,&butdown,&mx,&my); if(mxv2) Cconws("\33C"); if(myv3) Cconws("\33B"); p3=butdown; v2=mx; v3=my; } while(!p3); do { vq_mouse(handle,&v1,&v2,&v3); } while (v1); } vq_curaddress(handle,&p2,&p1); p3=butdown; p2+=31; p1+=31; p3+=32; Bconout(BC_AUX,p1); Bconout(BC_AUX,p2); Bconout(BC_AUX,p3); } if(val==2) { /* ? 2,x Send back mouse coordinates, button */ v4=f_value(0); vq_mouse(handle,&v1,&v2,&v3); if(v4) { /* poll the mouse */ vqm_attributes(handle,settings); vswr_mode(handle,3); i=0; points[0]=10000; points[1]=10000; do { vq_mouse(handle,&v1,&v2,&v3); if( points[0] != v2 || points[1] != v3) { if(i==1) v_pmarker(handle,1,points); points[0]=v2; points[1]=v3; i=1; v_pmarker(handle,1,points); } } while(!v1); /* don't exit till button released */ do vq_mouse(handle,&p1,&v2,&v3); while(p1); v_pmarker(handle,1,points); vswr_mode(handle,settings[3]); } /* make mouse values transmit in ascii */ v1+=48; v7=0; do { if(v2>9999) v2=9999; if(v7==1) v2=v3; if(v2>999) { v6=(v2/1000); Bconout(BC_AUX,v6+48); v2-=(v6*1000); if(v2<100) Bconout(BC_AUX,'0'); } if(v2>99) { v6=(v2/100); v6; Bconout(BC_AUX,v6+48); v2-=(v6*100); if(v2<10) Bconout(BC_AUX,'0'); } if(v2>9) { v6=(v2/10); Bconout(BC_AUX,v6+48); v2-=(v6*10); } if(v2>0) { v6=v2; Bconout(BC_AUX,v6+48); } else Bconout(BC_AUX,'0'); v7++; Bconout(BC_AUX,','); } while(v7<2); Bconout(BC_AUX,v1); Bconout(BC_AUX,':'); } if(val==3) { /* send the host the current rez */ i=Getrez(); i+=48; Bconout(BC_AUX,i); Bconout(BC_AUX,':'); } } if (key=='G') { /* Grab a piece of the screen. */ /* G to_screen_or_mem,mode,xs1,ys1,| xs2,ys2, | xd1,yd1 */ vq_extnd(handle,1,work_out); val=f_value(0); v7=f_value(0); v1=f_value(1); v2=f_value(2); if(val==2) { v3=(vd3-vd1)+v1; v4=(vd4-vd2)+v2; } if(val==1 || val==0 || val==3) { v3=f_value(1); v4=f_value(2); } if(val==0 || val==3) { /* if blit to screen get dest area */ v5=f_value(1); v6=f_value(2); } p1=Getrez(); if(p1>2) p1=0; /* limit to ST modes */ if(p1==0) { if(v1>319) v1=319; if(v3>319) v3=319; if(v5>319) v5=319; } if(p1==0 || p1==1) { if(v2>199) v2=199; if(v4>199) v4=199; if(v6>199) v6=199; } if(p1==2) { if(v2>399) v2=399; if(v4>399) v4=399; if(v6>399) v6=399; } if(p1==1 || p1==2) { if(v1>639) v1=639; if(v3>639) v3=639; if(v5>639) v5=639; } pxy[0]=v1; pxy[4]=v1; pxy[1]=v2; pxy[5]=v2; pxy[2]=v3; pxy[6]=v3; pxy[3]=v4; pxy[7]=v4; if(val==1) { vd1=v1; vd2=v2; vd3=v3; vd4=v4; } if(val==2) { pxy[0]=vd1; pxy[1]=vd2; pxy[2]=vd3; pxy[3]=vd4; pxy[6]=(vd3-vd1)+v1; pxy[7]=(vd4-vd2)+v2; } /* from 0=screen to screen, 1=screen to mem, 2=mem to screen */ if(val>3) val=3; sourceMFDB.image=0L; destMFDB.image=bitblt_storage; destMFDB.width=vd3-vd1; destMFDB.height=vd4-vd2; destMFDB.wordw=((vd3-vd1)/16)+1; if(destMFDB.wordw>40) destMFDB.wordw=40; destMFDB.flag=0; destMFDB.planes=work_out[4]; if(val==0 || val==3) { /* set dest area for a blit to screen */ pxy[4]=v5; pxy[5]=v6; pxy[6]=(v3-v1)+v5; pxy[7]=(v4-v2)+v6; } if(v7>15) v7=3; /* set to replace mode if err */ for(i=0;i<8;i++) if(pxy[i]<0) pxy[i]=0; if(val==0) { destMFDB=sourceMFDB; vro_cpyfm(handle,v7,pxy,&sourceMFDB,&destMFDB); } if(val==1) vro_cpyfm(handle,v7,pxy,&sourceMFDB,&destMFDB); if(val==2 || val==3) vro_cpyfm(handle,v7,pxy,&destMFDB,&sourceMFDB); } if (key=='I') { /* I x INITIALIZE */ /* inits to what ever the attributes of the calling program or desktop were set to. */ /* x = 0 init pallet and attributes */ /* x = 1 init pallet ONLY */ /* x = 2 init attributes ONLY */ /* x = 3 inti IG default pallete */ val=f_value(0); if(val>3) val=0; if(val==0) { org_pallet(); reset_attributes(); } if(val==1) org_pallet(); if(val==2) reset_attributes(); if(val==3) for(val=0; val<16; val++) vs_color(handle,val,sys_color[val] ); } if (key=='A') { /* A t p b fill ATTRIBUTES */ /* t=type (0-3) 0=hollow 1=solid 2=pattern 3=hatch */ /* p=pattern (1-24) works only with pattern & hatch types */ /* b=border 0=no border any other value yields a border */ val=f_value(0); p1=f_value(0); p2=f_value(0); if (val>3) val=0; vsf_interior(handle,val); vsf_style(handle,p1); vsf_perimeter(handle,p2); } if (key=='B') { /* B tlx tly brx bry r BAR (rectangle) filled */ /* tl=topleft corner x y cords. */ /* br=bottom right x y cords. */ /* r=rounded corners? (1=yes 0=no) */ sides[0]=f_value(1); sides[1]=f_value(2); sides[2]=f_value(1); sides[3]=f_value(2); val=f_value(0); if ( ! val ) v_bar(handle,sides); if ( val ) v_rfbox(handle,sides); } if (key=='C') { /* C x pen -set polymarker, line, fill */ /* and "WRITTEN" text color */ /* where x=(0-4) 0=marker 1=line 2=fill 3=text */ /* pen = (0 - 15) VDI pen not color register */ p1=f_value(0); val=f_value(0); if (val>15) val=0; if (p1>3) p1=0; if(p1==0) vsm_color(handle,val); if(p1==1) vsl_color(handle,val); if(p1==2) vsf_color(handle,val); if(p1==3) vst_color(handle,val); } if (key=='D') { /* D x y DRAWTO */ /* use P x y to set starting point and be sure */ /* type is T 1 1 1 if you want a pixel point */ lines[0]=lines[2]; lines[1]=lines[3]; lines[2]=f_value(1); lines[3]=f_value(2); v_pline(handle,2,lines); lines[0]=lines[2]; lines[1]=lines[3]; } if (key=='E') { /* E font size rotation EFFECTS for "WRITTEN" text */ /* font(1,2,4,8,16) size(8,9,10,16,18,20 (in points 1/72") */ /* rotation (0-4) = *90 degrees */ p1=f_value(0); p2=f_value(0); p3=f_value(0); vst_effects(handle,p1); if (p3>4) p3=0; p3 *=900; vst_rotation(handle,p3); if (p2<8) p2=8; if (p2>20) p2=20; vst_point(handle,p2,&p1,&p3,&v1,&v2); } if (key=='F') { /* F x y FLOOD FILL color replace mode */ p1=f_value(1); p2=f_value(2); v_contourfill(handle,p1,p2,-1); } if (key=='H') { /* H x HOLLOW ( frames ) */ /* x=1 on x=0 off */ val=f_value(0); if ( val>1 ) val=1; if ( val==1 ) { vsf_interior(handle,0); vswr_mode(handle,2); vsf_perimeter(handle,1); } if ( val == 0 ) { vsf_interior(handle,1); vswr_mode(handle,1); vsf_perimeter(handle,0); } } if (key=='J') { /* J x y xradius yradius begin_angle end_angle */ /* ELLIPTICAL ARC */ p1=f_value(1); p2=f_value(2); p3=f_value(1); v1=f_value(2); v2=f_value(0); v3=f_value(0); v2 *= 10; v3 *= 10; v_ellarc(handle,p1,p2,p3,v1,v2,v3); } if (key=='K') { /* K x y radius begin_angle end_angle ARC */ p1=f_value(1); p2=f_value(2); p3=f_value(1); v1=f_value(0); v2=f_value(0); v1 *= 10; v2 *= 10; v_arc(handle,p1,p2,p3,v1,v2); } if (key=='Z') { /* Z x_up_left y_up_left x_low_right y_low_right */ /* FILLED RECTANGLE */ sides[0]=f_value(1); sides[1]=f_value(2); sides[2]=f_value(1); sides[3]=f_value(2); vr_recfl(handle,sides); } if (key=='U') { /* U left_edge top_edge right_edge bottom_edge fill_flag */ /* ROUNDED RECTANGLE */ sides[0]=f_value(1); sides[1]=f_value(2); sides[2]=f_value(1); sides[3]=f_value(2); val=f_value(0); if (val==0) v_rbox(handle,sides); if (val>0 ) v_rfbox(handle,sides); } if (key=='L') { /* L x y xEND yEND draw a line */ lines[0]=f_value(1); lines[1]=f_value(2); lines[2]=f_value(1); lines[3]=f_value(2); v_pline(handle, 2, lines); } if (key=='M') { /* M x graphics drawing MODE */ /* 1=replace, 2=Transparent, 3=XOR, 4=reverse transparent */ val=f_value(0); if (val<1 || val>4) val=1; vswr_mode(handle,val); } if (key=='g') { /* g x Set graphics scaling coordinates */ val=f_value(0); if (val<0 || val>2) val=0; g_s=val; g_res=Getrez(); } if (key=='O') { /* O x y radius CIRCLE */ p1=f_value(1); p2=f_value(2); p3=f_value(1); v_circle(handle,p1,p2,p3); } if (key=='P') { /* P x y polymarker plot */ points[0]=f_value(1); points[1]=f_value(2); v_pmarker(handle,1,points); lines[2]=points[0]; lines[3]=points[1]; } if (key=='Q') { /* Q x y xradius yradius OVAL (ellipse) */ p1=f_value(1); p2=f_value(2); p3=f_value(1); val=f_value(2); v_ellipse(handle,p1,p2,p3,val); } if (key=='R') { /* R x p set resolution 0-1 sys pallete 0-2 */ val=f_value(0); p1=f_value(0); rez=Getrez(); if ( val< 0 || val>1 ) val=rez; if (rez != 2 && rez!=val) { if(val==0) rez_change_low(); if(val==1) rez_change_med(); } /* Setscreen(-1L,-1L,val); */ clip_set(); if( p1==2 ) for(val=0; val<16; val++) vs_color(handle,val,sys_color[val] ); if( p1==1 ) for(p1=0; p1<16; p1++) vs_color(handle,p1,org_color[p1]); } if (key=='S') { /* S pen red green blue pen(0-15) rgb(0-7) */ /* SET PEN COLOR */ val=f_value(0); rgb[0]=f_value(0); rgb[1]=f_value(0); rgb[2]=f_value(0); if (val>15) val=0; for(p1=0; p1<3; p1++) { p2=rgb[p1]; switch(p2) { case 1: rgb[p1]=142; break; case 2: rgb[p1]=285; break; case 3: rgb[p1]=428; break; case 4: rgb[p1]=571; break; case 5: rgb[p1]=714; break; case 6: rgb[p1]=857; break; case 7: rgb[p1]=1000; break; default: rgb[p1]=0; break; } } vs_color(handle,val,rgb); } if (key=='T') { /* type of polymarker(1-6) and height(y*11) y=(1-8) */ /* type of line(1-6) and thickness(1-40) */ /* 1 for marker 2 for line */ /* G#T 1 3 8 marker G#T 2 1 40 line */ /* T 2 1 50 (to 54) arrowhead endlines */ /* T 2 1 60 (to 64) rounded endlines */ /* T 2 1 0 square endlines */ p1=f_value(0); if ( p1<1 || p1>2 ) break; p2=f_value(0); if ( p2<1 || p2>6 ) p2=1; if ( p1 == 1 ) { p3=f_value(0); if (p3<1 || p3>8 ) p3=1; vsm_type(handle,p2); vsm_height(handle,p3*11); } if (p1==2) { p3=f_value(0); if (p3<42 && p3>0) { if (p2>1) p3=1; vsl_type(handle,p2); vsl_width(handle,p3); } if (p3==0) vsl_ends(handle,0,0); if (p3==50) vsl_ends(handle,1,1); if (p3==51) vsl_ends(handle,1,0); if (p3==52) vsl_ends(handle,0,1); if (p3==53) vsl_ends(handle,1,2); if (p3==54) vsl_ends(handle,2,1); if (p3==60) vsl_ends(handle,2,2); if (p3==61) vsl_ends(handle,2,0); if (p3==62) vsl_ends(handle,0,2); if (p3==63) vsl_ends(handle,2,1); if (p3==64) vsl_ends(handle,1,2); } } if (key=='V') { /* V x y radius beginangle endangle PIESLICE */ p1=f_value(1); p2=f_value(2); p3=f_value(1); v1=f_value(0); v2=f_value(0); v1 *=10; v2 *=10; v_pieslice(handle,p1,p2,p3,v1,v2); } if (key=='W') { /* W x y string "WRITE" text to x y coord. */ p1=f_value(1); p2=f_value(2); f_get_text(); v_gtext(handle,p1,p2,text); } if (key=='Y') { /* Y x y xradius yradius beginangle endangle OVAL-PIESLICE */ p1=f_value(1); p2=f_value(2); p3=f_value(1); v1=f_value(2); v2=f_value(0); v3=f_value(0); v2 *=10; v3 *=10; v_ellpie(handle,p1,p2,p3,v1,v2,v3); } if(key=='n') { /* n, PLAY_NOTE */ /* Musical Note Routine has 6 parameters p1-p6 */ /* 1 = effect number(1-19) 2 = voice number(0-2) */ /* 3 = volume(0-15) 4 = pitch(0-255) */ /* 5 = pause in 200ths sec (0-9999) */ /* 6 = stop sound type (0-4) */ v1=f_value(0); v2=f_value(0); v3=f_value(0); v4=f_value(0); v5=f_value(0); v6=f_value(0); play_note(v1,v2,v3,v4,v5,v6); } if (key=='t') { /* t x TIME */ /* pause BBS by sending a cntrl-s and time it for x seconds */ /* then send a ctrl-q 30 second max */ val=f_value(0); if(val>30) val=30; timer1 = clock1(); do { timer2 = clock1(); if(Bconstat(BC_CON)) { Bconin(BC_CON); val=0; } } while ( ((timer2/CLK_TCK)-(timer1/CLK_TCK)) < val ); } if (key=='m') { /* m x t CURSOR MOVEMENT */ /* x= function number t=number of times to execute */ val=f_value(0); p1=f_value(0); if(val>4) val=0; p2=0; do { Bconout(2,27); if(val==0) Bconout(2,'H'); if(val==1) Bconout(2,'A'); if(val==2) Bconout(2,'B'); if(val==3) Bconout(2,'C'); if(val==4) Bconout(2,'D'); p2 ++; } while(p222) val=0; sound_test: if(val<20) { switch(val) { case 0: for(i=0;i<5*CLK_TCK;++i) snd_on(aa,-1,-1,-1,1); break; case 1: for(i=0;i<5*CLK_TCK;++i) snd_on(ab,-1,-1,-1,1); break; case 2: for(i=0;i<5*CLK_TCK;++i) snd_on(ac,-1,-1,-1,1); break; case 3: for(i=0;i<5*CLK_TCK;++i) snd_on(ad,-1,-1,-1,1); break; case 4: for(i=0;i<5*CLK_TCK;++i) snd_on(ae,-1,-1,-1,1); break; case 5: snd_on(af,-1,-1,-1,1); break; case 6: snd_on(ag,-1,-1,-1,1); break; case 7: snd_on(ah,-1,-1,-1,1); break; case 8: snd_on(ai,-1,-1,-1,1); break; case 9: snd_on(aj,-1,-1,-1,1); break; case 10: snd_on(ak,-1,-1,-1,1); break; case 11: snd_on(al,-1,-1,-1,1); break; case 12: snd_on(am,-1,-1,-1,1); break; case 13: snd_on(an,-1,-1,-1,1); break; case 14: snd_on(ao,-1,-1,-1,1); break; case 15: snd_on(ap,-1,-1,-1,1); break; case 16: snd_on(aq,-1,-1,-1,1); break; case 17: snd_on(ar,-1,-1,-1,1); break; case 18: snd_on(as,-1,-1,-1,1); break; case 19: snd_on(landing,-1,-1,-1,1); break; } } if(val==20) { /* b 20,play_flag,snd_num,element_num,negative_flag,thousands,ones */ v1=f_value(0); /* play_flag */ v2=f_value(0); /* snd_num */ if(v2>19) v2=19; v3=f_value(0); /* element_num */ if(v3>55) v3=55; v4=f_value(0); /* negative_flag */ v5=f_value(0); /* thousands place */ if(v5>32) v5=32; v5=v5*1000; v6=f_value(0); /* ones to 999s place */ v7=v5+v6; if(v4) v7=0-v7; switch(v2) { case 0: aa[v3]=v7; break; case 1: ab[v3]=v7; break; case 2: ac[v3]=v7; break; case 3: ad[v3]=v7; break; case 4: ae[v3]=v7; break; case 5: af[v3]=v7; break; case 6: ag[v3]=v7; break; case 7: ah[v3]=v7; break; case 8: ai[v3]=v7; break; case 9: aj[v3]=v7; break; case 10: ak[v3]=v7; break; case 11: al[v3]=v7; break; case 12: am[v3]=v7; break; case 13: an[v3]=v7; break; case 14: ao[v3]=v7; break; case 15: ap[v3]=v7; break; case 16: aq[v3]=v7; break; case 17: ar[v3]=v7; break; case 18: as[v3]=v7; break; case 19: landing[v3]=v7; break; } if(v1) { val=v2; goto sound_test; } }/* endif val==20 */ if(val==21) { /* b 21: STOP all sound */ stop_snd(0); stop_snd(1); stop_snd(2); } if(val==22) { /* b 22,snd_num */ snd_num=f_value(0); if(snd_num>19 || snd_num<0) snd_num=0; for(snd_ele=0;snd_ele<56;snd_ele++) { switch(snd_num) { case 0: aa[snd_ele]=snd_patches[0][snd_ele]; break; case 1: ab[snd_ele]=snd_patches[1][snd_ele]; break; case 2: ac[snd_ele]=snd_patches[2][snd_ele]; break; case 3: ad[snd_ele]=snd_patches[3][snd_ele]; break; case 4: ae[snd_ele]=snd_patches[4][snd_ele]; break; case 5: af[snd_ele]=snd_patches[5][snd_ele]; break; case 6: ag[snd_ele]=snd_patches[6][snd_ele]; break; case 7: ah[snd_ele]=snd_patches[7][snd_ele]; break; case 8: ai[snd_ele]=snd_patches[8][snd_ele]; break; case 9: aj[snd_ele]=snd_patches[9][snd_ele]; break; case 10: ak[snd_ele]=snd_patches[10][snd_ele]; break; case 11: al[snd_ele]=snd_patches[11][snd_ele]; break; case 12: am[snd_ele]=snd_patches[12][snd_ele]; break; case 13: an[snd_ele]=snd_patches[13][snd_ele]; break; case 14: ao[snd_ele]=snd_patches[14][snd_ele]; break; case 15: ap[snd_ele]=snd_patches[15][snd_ele]; break; case 16: aq[snd_ele]=snd_patches[16][snd_ele]; break; case 17: ar[snd_ele]=snd_patches[17][snd_ele]; break; case 18: as[snd_ele]=snd_patches[18][snd_ele]; break; case 19: landing[snd_ele]=snd_patches[19][snd_ele]; break; } /* end switch */ } /* end for */ } /* endif val==22 */ } if(key=='i') { /* i x t LINE INSERTS */ /* x (0-1) 0= cursor up insert blanks if at top of screen */ /* x (0-1) 1= insert line at cursor, bottom line is scrolled off */ /* t = number of times to do this. */ val=f_value(0); p1=f_value(0); if(val>1) val=0; p2=0; do { Bconout(2,27); if(val==0) Bconout(2,'I'); if(val==1) Bconout(2,'L'); p2 ++; } while(p21) val=0; Bconout(2,27); if(val==0) Bconout(2,'j'); if(val==1) Bconout(2,'k'); } if(key=='d') { /* d x DELETE LINE scroll screen up a line at bottom. */ /* x = number of lines to delete */ val=f_value(0); p2=0; do { Bconout(2,27); Bconout(2,'M'); p2 ++; } while(p2 cursor */ /* x=1 clear line from begining to cursor inclusive */ /* x=2 clear at cursor to end of line */ val=f_value(0); if(val>2) val=0; (Bconout(2,27); if(val==0) Bconout(2,'l'); if(val==1) Bconout(2,'o'); if(val==2) Bconout(2,'K'); } if(key=='s') { /') { /') { /') { /') { /ad endlines */ /* T 2 1 60 (to 64) rounded endlines */ /* T 2 1 0 square endlines */ p1=f_value(0); if ( p1<1 || p1>2 ) break; p2=f_value(0); if ( p2<1 || p2>6 ) p2=1; if ( p1 == 1 ) { p3=f_value(0); if (p3<1 || p3>8 ) p3=1; vsm_type(handle,p2); vsm_height(handle,p3*11); } if (p1==2) { p3=f_value(0); if (p3<42 && p3>0) { if (p2>1) p3=1; vsl_type(handle,p2); vsl_width(handle,p3); } if (p3==0) vsl_ends(handle,0,0); if (p3==50) vsl_ends(handle,1,1); if (p3==51) vsl_ends(handle,1,0); if (p3==52) vsl_ends(handle,0,1); if (p3==53) vsl_ends(handle,1,2); if (p3==54) vsl_ends(handle,2,1); if (p3==60) vsl_ends(handle,2,2); if (p3==61) vsl_ends(handle,2,0); if (p3==62) vR */ /* f=0 set background f=1 set text color */ /* x = color register */ p1=f_value(0); p2=f_value(0); if(p1>1) p1=0; Bconout(2,27); if(p1==0) { Bconout(2,'c'); Bconout(2,p2); } if(p1==1) { Bconout(2,'b'); Bconout(2,p2); } } if(key=='v') { /* v x VIDEO (inverse on/off) */ /* where x=0 off x=1 on */ val=f_value(0); if(val>1) val=0; Bconout(2,27); if(val==0) Bconout(2,'q'); if(val==1) Bconout(2,'p'); } if(key=='k') { /* k x CURSOR ( on/off ) and Destructive Backspace */ /* where x=0 off x=1 on */ /* x=2 destructive backspace on, x=3 destruction off */ val=f_value(0); if(val>3) val=0; if(val<2) Bconout(2,27); if(val==0) Bconout(2,'f'); if(val==1) Bconout(2,'e'); if(val==2) des_backsp=1; if(val==3) des_backsp=0; } if(key=='w') { /* w x LINE WRAP ( on/off ) */ /* where x=0 off x=1 on */ val=f_value(0); if(val>1) val=0; Bconout(2,27); if(val==0) Bconout(2,'w'); if(val==1) Bconout(2,'v'); } } while(lp_flg==1 && bad_cmd !=0); /* end do '&' command */ } lp_type=' '; is_gang='X'; /* zero @ option LOOP; null gang */ } while ( chain == '>' ); lp_flg=0; if(mem_key_flg) { mem_key_flg=0; for(v1=1;v12) p2=2; if(p2<0) p2=0; if(p1>19 && p1!=125) p1=19; if(p3>15) p3=15; if(p3<0) p3=0; if(p4>255) p4=255; if(p5<0) p5=0; if(p6>4) p6=4; if(p6<0) p6=0; if(p4>0) { switch(p1) { case 0: snd_on(aa,p2,p3,p4,7); break; case 1: snd_on(ab,p2,p3,p4,7); break; case 2: snd_on(ac,p2,p3,p4,7); break; case 3: snd_on(ad,p2,p3,p4,7); break; case 4: snd_on(ae,p2,p3,p4,7); break; case 5: snd_on(af,p2,p3,p4,7); break; case 6: snd_on(ag,p2,p3,p4,7); break; case 7: snd_on(ah,p2,p3,p4,7); break; case 8: snd_on(ai,p2,p3,p4,7); break; case 9: snd_on(aj,p2,p3,p4,7); break; case 10: snd_on(ak,p2,p3,p4,7); break; case 11: snd_on(al,p2,p3,p4,7); break; case 12: snd_on(am,p2,p3,p4,7); break; case 13: snd_on(an,p2,p3,p4,7); break; case 14: snd_on(ao,p2,p3,p4,7); break; case 15: snd_on(ap,p2,p3,p4,7); break; case 16: snd_on(aq,p2,p3,p4,7); break; case 17: snd_on(ar,p2,p3,p4,7); break; case 18: snd_on(as,p2,p3,p4,7); break; case 19: snd_on(landing,p2,p3,p4,7); break; } } ext=0; if(p5==0) ext=1; timer1 = clock1(); while (ext==0) { timer2 = clock1(); if(Bconstat(BC_CON)) { Bconin(BC_CON); ext=1; } if ( (timer2-timer1) >= p5 ) { ext=1; } } /* end while ext==0 */ if(p6>0) { if(p6==1) snd_off(p2); if(p6==2) stop_snd(p2); if(p6==3) { snd_off(0); snd_off(1); snd_off(2); } if(p6==4) { stop_snd(0); stop_snd(1); stop_snd(2); } } } /*************/ get_char() { unsigned char kar; kar=0; f_ct ++; bytes_parsed ++; if (f_ct>=bytes_read && bytes_left>0 ) { read_file(); f_ct=0; if (bytes_read>0) kar=filebuffer[f_ct]; } if (f_ct0) { if ( ct<128 && key != '@' && key!=10 && key!=13) { text[ct] = key; ct++; } if ( ct==128 || key=='@' ) { if(ct==0) { text[ct]='@'; ct++; } text[ct]=0; recieving=0; } } } bad_cmd=1; } /**********/ f_value(x_y) int x_y; { float scale_ratio,round; int num,v1,v2,v3,v4,ct,flg,key,x_screen,y_screen, plus_minus_flg; unsigned long t1, t2; num=0; v1=0, v2=0, v3=0, v4=0, ct=0, flg=0, plus_minus_flg=0; if(lp_flg==0) { f_v_jmp: do { key = get_char(); if (key<48 || key>57) flg=1; else { ct++; switch(ct) { case 1: v1=key-48; break; case 2: v2=key-48; break; case 3: v3=key-48; break; case 4: v4=key-48; break; default: num=0; } } } while ( flg == 0 ); switch(ct) { case 4: v3*=10; v2*=100; v1*=1000; num=v4+v3+v2+v1; break; case 3: v2*=10; v1*=100; num=v3+v2+v1; break; case 2: v1*=10; num=v2+v1; break; case 1: num=v1; break; default: num=0; } if(g_s && x_y>0 && num>0) { /* If scaling set and desired do it! */ if(g_s!=2) { if((g_res==2 || g_res==1) && x_y==1) x_screen=639; if(g_res==2 && x_y==2) y_screen=399; if((g_res==1 || g_res==0) && x_y==2) y_screen=199; if(g_res==0 && x_y==1) x_screen=319; scale_ratio=9999/num; if(x_y==1) round=x_screen/scale_ratio; if(x_y==2) round=y_screen/scale_ratio; if(round-(int)round> .49) num=(int)round+1; if(round-(int)round< .5) num=(int)round; } /* g 2: option */ if(g_s==2 && x_y==2 && g_res==2) num*=2; } if(key=='_') { key=get_char(); key=get_char(); flg=0; goto f_v_jmp; } if(key==120) { num= -32767; key=get_char(); } if(key==121) { num= -32766; key=get_char(); } if(key=='r') { num= -32765; key=get_char(); } /**** ,+CONSTANT,-CONSTANT, !CONSTANT ****/ if(key=='+') { plus_minus_flg=1; flg=0; goto f_v_jmp; } if(key=='-') { plus_minus_flg=2; flg=0; goto f_v_jmp; } if(key=='!') { plus_minus_flg=3; flg=0; goto f_v_jmp; } if(plus_minus_flg==1) num= 0-num; if(plus_minus_flg==2) num= 0-10000-num; if(plus_minus_flg==3) num= 0-20000-num; } /* endif lp_flg */ if(lp_flg==1) { if (lp_eff_ct==0) lp_x=0; if(lp_eff_ct==0) { t1=clock1(); do { t2=clock1(); if(Bconstat(BC_CON)) break; } while (t2-t1 -30000 && lp_effect[lp_eff_ct]<0)) { lp_x++; if(lp_2nd==0) lp_was=lp1; if(lp_x<2 && lp_1st!=0) { lp1+=lp3; lp_2nd++; if(lp_2nd==1 && lp_type=='|') lp1=lp_was; if(lp_2nd==2 && lp_type=='|') lp_2nd=0; } if(lp_effect[lp_eff_ct]< -29999) num=lp1; lp_1st++; if(lp_effect[lp_eff_ct]== -32766) { if(lp5lp2) num=lp5-lp1; if(lp5==lp2) num=0; } /* +CONSTANT */ if(num<0 && num> -10000) num=abs(num)+lp1; /* -CONSTANT */ if(num< -9999 && num> -20000) { num+=10000; num=abs(num); num=lp1-num; } /* !CONSTANT */ if(num< -19999 && num> -30000) { num+=20000; num=abs(num); num-=lp1; } } /* Check for CTRL-C from user to abort LOOP */ if (Bconstat(BC_CON)) { key = Bconin(BC_CON); if (key == 3 || key==24) lp_flg=0; } if(lp_no_prams==1 && lp_eff_ct==0) lp1+=lp3; if(lp3>=1 && lp1>=lp2 && lp_eff_ct==(lp_num_prams-1)) lp_flg=0; if(lp3<0 && lp1<=lp2 && lp_eff_ct==(lp_num_prams-1)) lp_flg=0; if(lp_type!='@' && lp_flg==0 && lp_com=='W') lp_type='Z'; lp_eff_ct++; if(lp_eff_ct>=lp_num_prams) lp_eff_ct=0; } if(num== -32765 && r_lp==0) num=r_random(); bad_cmd=1; return(num); } /*********************/ reset_attributes() { int d1, d2,d3,d4; /** Sets attributes that were active at time program was ran **/ vsm_type(handle,polym_sets[0]); vsm_color(handle,polym_sets[1]); vswr_mode(handle,polym_sets[2]); vsm_height(handle,polym_sets[3]); /*** end of polymarker restore ****/ vsl_type(handle,line_sets[0]); vsl_color(handle,line_sets[1]); vsl_width(handle,line_sets[3]); vsl_ends(handle,line_sets[4],line_sets[5]); /*** end line set restore ***/ vsf_interior(handle,fill_sets[0]); vsf_color(handle,fill_sets[1]); vsf_style(handle,fill_sets[2]); /*** end fill restore ***/ vst_color(handle,text_sets[1]); vst_rotation(handle,text_sets[2]); vst_effects(handle,0); vst_height(handle,text_sets[7],&d1,&d2,&d3,&d4); } /*****************/ help_display() { Cconws("\33E\33p Instant Graphics! "); Cconws("\n\r\33q Copyright 1988-92 by Larry Mears, all rights reserved. v2.17 Shareware"); Cconws("\n\r *--------------------------------------------------------------------*"); Cconws("\n\r |Send $15 appreciation fee to: |"); Cconws("\n\r | Larry Mears 11027 Crestfield Dr. Huntsville, Alabama 35803 USA |"); Cconws("\n\r |IG Emulator Support: BIG City WWIVNET Node 2509 205-880-9896 |"); Cconws("\n\r |--------------------------------------------------------------------|"); Cconws("\n\r |IG XNET Support: London Smog Node 632 714-546-2152 |"); Cconws("\n\r |IG UK Support: Internet Node 1031 +44-296-395935 |"); Cconws("\n\r |....................................................................|"); Cconws("\n\r | Help This display | F5 Resolution Lock toggle |"); Cconws("\n\r | Undo Exit program | F6 Duplex toggle |"); Cconws("\n\r | ClrHome Reset color,attributes | F7 Display a file |"); Cconws("\n\r | Insert Set Baud rate | F8 Execute file graphics |"); Cconws("\n\r | + MIDI Sync adjust | F9 Activate graphics |"); Cconws("\n\r | F4 MIDI on / off | F10 Deactivate graphics |"); Cconws("\n\r *--------------------------------------------------------------------*\n\n\r\33e"); } clock1() { unsigned long User_stack = Super(0L); unsigned long ticks = *(unsigned long *)0x4ba; Super(User_stack); return ticks; } get_aux_char() { int ext, c_aux; unsigned long timer1,timer2; ext=0; timer1 = clock1(); while (ext==0) { timer2 = clock1(); if (Bconstat(BC_AUX)) { c_aux = Bconin(BC_AUX); ext=1; } /* time out in 5 seconds */ if ( ((timer2/CLK_TCK)-(timer1/CLK_TCK)) > 4 ) { c_aux=' '; Bconout(BC_CON,7); ext=1; } } /* end while ext==0 */ return(c_aux); } r_random() { unsigned long rd; int rx; do { rd=Random(); rx=(int)rd; if(rnd_t<256) rx=(unsigned char)rd; } while(rxrnd_t); return(rx); } xoff() { int x_i; if(x_on) { for(x_i=0;x_i