@L:}6CD l0C)HCC WhL/h `CmCDiD`  R@P1  Y0@R !L` D @) DD)˝*+`Y䭣Y䍤_ S`__LE: B V JBRDE V`aŪ D @) DD)˝*+`Y䭣Y䍤_ S}`__LE: B V JBRDE V`a`jW`jD˙` d J)L !}D L(( LL()  L| L( S LH 0p n  } CY?  q  L L  ` )} `A! d߰")-݆ "  $G@LLL&0") $G% }H0 3S8`G ȱG ȱG   Gȭ Gȭ GG}GHiH8(()) G$H% `(0 })8` d)L ݆ & LGȘ ݆LL d  ! LL d)N>Q  HH) }  hyhyB q L> Lm JJ  Ln*` dB%' }8  H H` 1 { LL   !L     Hh Y?  q  1L }  !? S   q 1 L   Ll  Lg E`L   !L)  q 1L}) `L0AM݊L݉ ML  N݆LLLNLMLHG!@}1F GȱGLLEEȩÑEȑEEȑE Ed E7EȩE  q} L !,0,0SGɛ L 1 !L EHEh W G gLLSROTCES EERF } G) *Gȩ GȽG GȌd q q G`  8   0G  `D}CEDC0X:Ȣ Y ȱC* ? 0.. , 0%n ?A[ 0 : L`L  `, 0`Y}`piH n0)բY? 08`0 }  0$L GGȽG L `8L`L}8`  05GL8G)ȱGȱGHh0})Hh` B! 8`8iiiLE`}E8FEh( l0`ɃLL L8^~jj8jHi hEEEiEȱEiE` dTE} H8EEȱEEȩEh J E8   . m  i`LI!)E1FR}1LJ舩9GIH`LJJ`HGHh l`}  gL   8 rii `дCDCG W  }C  Lq` X٨`DOS SYS IIIIIIIIIIIIIIIC`0 ߩ0}}0}EwC >;;DOSDOS SYS }}}433}CDOS SYS} densitydoublesingle0r0 rr0r0 r0 @&@@|30B0\1`@\2`@$o@0.A$}=@\WB'!"ԩ L:!!BL>3U J ]L!T  LLLLLLLLL}LLLL }LL[ T`HIB VL$`lllLLLLD1:D:STARTUP.EXCP.EXCD1:DCOPY.COMCOM!}@DCOPYN.SYSM 41 BATCH.COM 41 RAMLOAD.COM 42 BATCH.COM 42 14 FASTER.COM 14+"}]++L-5  LQ_t_"~#Z [䝀5iUiVifigi#}OiP$ic%ido \X ^AXR`aLH Th78`!" ' IL$}< I@L XLLh@LY    `ԩթ }LError # LT ؠ0 T)LTɛ%};󩛑78!"`8 B VLD  }DEIB V0ЮH &}: lЧ.COM pB؝DEJ V L#â }LNot binary!L#   '}DE8倝H偝IHIB V0 LL   L#  L# RS @(}k }L}(c) LIGHTSPEED DOS_  _@  L#D:AUTORUN.SYSD:: ɛ )} Ȍ``LYRNPW601:  )Ӡ 0)*}` ɀ  ;㩁LFL;)Ӣ  ) ) &i@` >, (+}LX,` 8L `Ơ`Ȇɠ V*̅iʥi˩ͨ Π`ʆiȥiɠͱʅ̅,} Ω`᥄⥅ -`᥅ 0-` q` n+` . 8 1Lhihič-}ȱčȱĨL  &`` Jf``UVTLe L ` d!` . "L%/ i*` y*` L, /.}L, L# LQ& . s!`  '`  '` L( .L% LA& /L, L7(  8 !,L L, Ll, L Lc, Lu, #!/}` 1!` $` L45…ȱ…ťiÈią ȱiąՈL6ȱĈL6…ȱ…ťiñąՈąiȱiĈL6…0}…ťi8ą԰ ȱąՈL6ȱąՈL6…ȱ…ťiñąՈą8ĐL6ȱĈL6rkLN1}[L…ȱ…8ԈĥBL…ȱ…8ԈĪ0(L"8¥ԥiàL6Ԅՠªȱ…Æ L68ª2}0ƊL"˥ԈL"ФԈLq…ԥq…Lj6…ȱ…ťiåqąԥqąՈL6eȱeť3}iåiđđL6eȱeťiLeȱeťiL'eȱeťiLVeȱ4}eťiLeȱeťiőđLj6eȱeňeԅȱeՅLj6eȱeťiñ‘ąՈ‘ą5}Lj6eȱeűąՈąLj6eȱeňąԄLj6 ԄL6L6ƅȢ`BƅDž B VBE 6}ȝK)IJL_"S:_A [ a{`` " ȈȈ`҈ұ) ƝҠ) Ƞ)7}`ƙȥ`ː"ʐ̱ȑ`eͅeͅˤȑʈȑʥˈ``8}``` `ƅɈƅȹɛȩ`0:`` G `! *qHqƪh`L!lȱňı89}8必ƥDZ…ȱ…ťi !ԆL7 !H !h` T`* bLb" `ƅˈƅʈƅɈƅ` !ƝB :}EƝD IƝH ƝJ ƝK V Ii`` !L!BHIL_"ȱ G"F"";}" Lb" "ձʑ `ƙȄͦʥ``ƅɈƅȢ`ƅȱƅ̠ƅȱȪ̑Ȋ` <}"HȱȪh` "ȅȱȅͥˑȥʈȦͥ`ƅƅ إԅ) ٥0Ԧ`IIi`eԅԐL6e !ƙ=}ȩ̭ʈ` !ƝLȱƝMȱƝN%BL_" r" H r"h`Lb" "ƈL"HpƝDȱƝEhBL_"#$>} ީ!&$ȩ&$`&$' 2$2ƅȱƅL180H1h`eHȱeǪh`ƅɈƅȱȥȦ qLF60``?} ` !iȥi !Ȇ ȅɅL$`Т   ````/1ɱƍB% &Ƞem-1ȭ.@}1eɅɠƅȱƅˠʨ˱ʑȈʑȠƍ`e΅T e8΅T[U\VLee̅T e8̅T[U\VLeƙA}΅υ 8ԅ ̐`e΅UeυV g%e̅UeͅV E%8΅UυV g%8̅UͅV E% & &ieeB}ԅL<&8̅ԥͅե & &i eeՅL%ƪȱƨ ݩLd&ƪȱƨ ݩ$)ԩ#e' (ې`)8@0+C}Յ)e)e ݦ `F ݢ5' `ڢ ڰ' @ݢ F IԠƅˈƅʢL,U9D}>`D'RFuCU?b9dYdg@W2@?tS)%@```/ 6/B`,1` 6/B` ' BL_" 'B V()`E}` !ƝIƝHƝEƝD` " ``` ƪТ`ƪƨ0 =Т` ƪ Т`ƪF}ƨ0 = Т` &(` &(`ƪ q`ƪȱƨ ݩ)@0)%ԅԢ ޢ ڰ9 @ݰ.G} ڰ" fڥԅԥ /' (L&ƅȱƅȄ`̽ɛ ,`̽ɛ ,` )hH}hLb"̮֩(HIDEB V8``ʅ͍(ȩɱ !(ƅɈƅȄ (ʱ` i*% LbI}" H (hD$̅ (ԑȥՑ (Lt)F$̅ (ԑΈ (Lt)S%̅ ( (̪ʊ8ĨȩΈJ}Lt)CLt) (̽ (Lt) "̄ͱʅαͥ``ȱܱƅɈƅȢ`{a `K}A[i Ls* "Π i*Ȉȱ :& șȈ..Ȅ̤αʤ̑`@L}i`ƝDȱƝEBȱƆ i*ARWUD`   J V0JJJJ`Lb"ƨx`ƨТ`M}ȭ Ȑ Ң`ƝEƝDBI VLb"($` !L+ !B0ƝKƝDȱƝELD+FL3ʱƪȱN} ؠ0.)ȩ.ȩ0ȩL2ȱ)L ,ƅƅƅ͈ƅ̄ LX,ƙșʙ`̈` >, LO}X, >, fLX, >, `LX, "ș ޠʈ`) 5Ԇՠƅȱƅ ٥΅L, >, ަʤ LX, "ș L,P}ƅɈƅȠș ٥Ԧ`&&& L*- `ɀE ɀf8ਊ Q}-$ 8$P 8`E0 IIL-8L-Ff eeJfff$R} 8`!67%7z66667M7V7d7{77887778*8C8_8p8{888888899A9g9w9999999999 ::2:L8Bx9NaS}v2Ns ..E:T:[:t##7w855o55…ȱ…ťi .L6l8…iƥiȱ.T}. 0ԆՠiL6Ʃ`ƩǠ`ȆɄʥˠ``  5L%/  w'L%/  l'L%/  ,L%/  #L%/ U}/ /#L%/ "ƠLi ƅɈƅȠƅʩˠL*ƅՈƅ ؠƅȱƅɠ0)ȩ`86ƍ/ȭ6ƍ/ǐ V}/6/6``m66ȱm66`6`66`L6L4Lc1L"LM*L"L*L L*L+L"L 5Lr"L"L!L!L1L!L+L+L4L*Lf*Lv*L"L#L"#LW},#L'LF#Lc,LLl,Lu,L~,L,L,L;'L@'Le LQ&L,L,L!,L5L7(L LS5L4L4L4L4LW+La+Lk+LJ'Lb'Lw'Ll'L'LG L LwL;!L-L0-LF6L#!L1!X}L`!Ls!L!LZ5L#L#L#L#L$L$L$L"$L5$LO$L^$Lm$L$L$L$L$L$L%LA&LD'L'L'L'L(L(L2)L\'Ly4Lo4Ll/L/L/LQ4L/L`/L/LY}E/L*/L3/L= 0 DO cprintf("%f %c %f ",a,c,b) ifp} c= '+ then fadd(a,b,sum) cprintf("= %f%n",sum); elseif c= '- then fsub(a,b,sum) cprintf("= %f%n",sum); elseif c= '* q}then fmul(a,b,sum) cprintf("= %f%n",sum); elseif c= '/ then fdiv(a,b,sum) cprintf("= %f%n",sum); else cprintf("%c is r}an unkown operator.%n",c) fi OD RETURN0MODULE ;ŮԠSET $4E8=$1B5D ;MULTIPLYSET $4EA=$1B71 ;DIVIDESET $4EC=$1B81 ;REMAINDERINT FUNC dvcopen=*(CARD T1,t}T2,T3,T4) asetup1() [JMP $301B]PROC dvcmove=*(CARD source,dest,len) asetup1() [JMP $3015]INT FUNC OPEN(BYTE d,CHAR ARRAY u}f,BYTE m,a2) stoc(f) dvcopen(d,m,a2,f) [STOREINT] stoa(f) [$60]BYTE FUNC PEEK=*(CARD addr) asetup1() [JSR $3048 STOREBYTE $6v}0]CARD FUNC PEEKC=*(CARD addr) asetup1() [JSR $304E STOREINT $60]BYTE FUNC POKE=*(CARD addr, BYTE val) asetup1() [JMP $304Bw}]INT FUNC SCOMPARE(CHAR ARRAY s1,s2) stoc(s1) stoc(s2) asetup2() [JSR $3006$ STOREINT] stoa(s1) stoa(s2) [$60]BYTE FUNC STx}ICK=*(BYTE n) asetup1() [JSR $309C STOREBYTE $60]BYTE FUNC STRIG=*(BYTE n) asetup1() [JSR $309F STOREBYTE $60]PROC CLOSE=*y}(BYTE d) asetup1() [JMP 3021]PROC GRAPHICS=*(BYTE mode) asetup1() [JMP $308A]PROC MOVEBLOCK(CARD dest,source,len) dvcmove(sz}ource,dest,len) RETURNPROC POSITION=*(CARD col, BYTE row) asetup1() [JMP $3090]PROC POKEC=$315A(CARD addr, CARD val)PROC S{}COPY(STRING dest,source) stoc(dest) stoc(source) asetup2() [JSR $3009] stoa(source) stoa(dest) RETURNPROC SETBLOCK=*(CARD ad|}dr,size, BYTE value) asetup1() [JMP $3145]PROC SETCOLOR=*(CARD register,hue, BYTE luminance) asetup1() [JMP $3120]PROC SOUN}}0100 ;A simple floating point calculator to show how to use floating point functions with MAC/650110 ;Compare this program w }ith FCALC.C and FCALC.ACT0120 ;0130 .INCLUDE #D1:MACRO.M650140 .INCLUDE #D1:STDIO.M650150 .INCLUDE #D1:FLOAT. }M650160 ;0170 *= $40040180 JMP MAIN0190 ;0200 ;reserve space for variables0210 ;FA .FLOAT 0 ;SUPERCARTRIDGE }version ONLY!0220 ;FB .FLOAT 00230 ;SUM .FLOAT 00240 ;0250 FA .BYTE 1,2,3,4,5,60260 FB .BYTE 1,2,3,4,5,60270 SUM .BY }TE 1,2,3,4,5,60280 C .BYTE 00290 ;0300 MAIN DISPLAY "}Floating point calculator with MAC/65.",EOL0310 DISPLAY " }Enter: # [space] operator [space] #",EOL,EOL0320 MAINLP SCANF "%f %c %f",FA,C,FB0330 CPX #0 ;bad input such as h }itting the break key will exit to DOS0340 BEQ OKAY0350 RTS ;return to DOS0360 OKAY PRINTFS "%f ",FA ;PRI }NTFS is used for floating point and strings0370 PRINTF "%c ",C ;PRINTF is used for chars, integers, and unsigned0380 } PRINTFS "%f ",FB0390 LDA C0400 ADD? CMP #'+0410 BNE SUBTRACT?0420 FADD FA,FB,SUM ;SUM=A+B0430 JM }P ENDSWITCH0440 SUBTRACT? CMP #'-0450 BNE MULTIPLY?0460 FSUB FA,FB,SUM ;SUM=A-B0470 JMP ENDSWITCH0480 MULT }IPLY? CMP #'*0490 BNE DIVIDE?0500 FMUL FA,FB,SUM ;SUM=A*B0510 JMP ENDSWITCH0520 DIVIDE? CMP #'/0530 BN }E UNKOWN0540 FDIV FA,FB,SUM ;SUM=A/B0550 JMP ENDSWITCH0560 UNKOWN PRINTF "%c is an unkown operator.%n",C0570 } JMP MAINLP0580 ENDSWITCH PRINTFS "= %f%n",SUM ;NOTE: %n is used instead of \n0590 JMP MAINLP i/* BATCH.C *//* creates a file containing a command line which is run as a .COM file */ main() $( int iocb; char f}ilename[20],buf[130]; if(!getdos(filename)) $( printf("Enter filename:"); if(gets(filename)<1) exit(); /* nothing }specified */ $) normalize(filename,"COM"); if((iocb=fopen(filename,"r"))>0) $( /* get text from existing file if availa}ble */ fgets(buf,iocb); fclose(iocb); printf("Old text:\n%s\n",buf+6); $) else printf("Text?\n"); if(gets(b}uf)<1) exit(); /* get the new command line or exit */ if((iocb=fopen(filename,"w"))<0) $( printf("Can't open %s\n",file}name); exit(); $) putw(0xFFFF,iocb); /* header */ putw(0x15F6,iocb); /* commandbuffer for DOS */ putw(0x15F6+strl}en(buf),iocb); fputs(buf,iocb); /* send the string */ putw(0x15C1,iocb); /* zero the pointer */ putw(0x15C1,iocb); fp}utc(0x0,iocb); putw(0x2E0,iocb); /* change load/run address to point to DOS */ putw(0x2E1,iocb); putw(0x157A,iocb); e}xit();$)  /* CB.C *//* Control M will add a return, and control N will delete a return. *//* A '-' at the end of the filename will tu}rn off back-up option. */ #define SPACE 32#define EOL 155 int iocb,count,i,csflag,dflag,iocb2,len,size,pad;char} s[20],c,lastchar,nextchar,*bufptr,*endptr,bak[20],*address; main() $( int backup; address=lomem(100); size=highm}em()-address; pad=2; /* default indentation size */ dflag=csflag=iocb=count=lastchar=c=0; fast(); while(getdos(s)) $(} backup=1; /* default is to create a backup file */ closeall(); if(isdigit(s[3])) $( pad=atoi(s+3); c}ontinue; $) if((i=sfind(s,"-"))>=0) $( /* if there is a '-', then no backup */ *(s+i)=0; /* erase the dash */ } backup=0; /* no backup file */ $) strcpy(bak,s); normalize(s,"C"); if(backup) $( normalize(bak,"BA}K"); printf("%s <<< %s\n",s,bak); $) else printf("%s (no back-up)\n",s); if((iocb=fopen(s,"r"))<1) $( } printf("Can't open %s\n",s); continue; $) len=bgets(address,size,iocb); /* read in all of the text */ clo}se(iocb); if(backup) $( iocb2=fopen(bak,"w"); bputs(address,len,iocb2); /* write all of the text to a backup }*/ close(iocb2); $) endptr=address+len; /* get the length of the text */ *(endptr+1)=EOL; /* to avoid some }checks for end of buffer */ iocb=fopen(s,"w"); bufptr=address; while(isspace(*bufptr)) ++bufptr; /* remove any st}arting spaces */ for(;bufptr': case '<': case '!': /* space around !=,>=,<= */} if(*(bufptr+1) == '=') $( if(*(bufptr-1) != SPACE) out(SPACE); out(c); ++bufptr}; out('='); if(*(bufptr+1) != SPACE) out(SPACE); $) else out(c); break;} case '0': /* convert all hex to upper case */ out(c); if((c=tolower(*(bufptr+1))) == 'x') $( } out(c); bufptr+=2; while(hex(*bufptr)) out(toupper(*bufptr++)); --bufptr; } $) break; case '/': /* this handles comments */ if(*(bufptr+1) == '*') $( while(*}bufptr != EOL) out(*bufptr++); --bufptr; $) else out(c); break; case 13: /*} control M */ case EOL: /* this handles all returns */ out(EOL); if((bufptr+2)='0' && c<='9') || (tolower(c)>='a' && to}lower(c)<='f')) return 1; else return 0;$) 1/* COMPACT.C *//* This compacts ".COM" files */ char *buf,*begin,*end,*place,*endbuf,name[20];int tmp;main() $( int i}ocb; /* iocb must be defined last */ iocb=getread(name,"COM"); buf=lomem(100); endbuf=bgets(buf,highmem()-buf,iocb)+buf}; if(getint(buf) != 0xFFFF) $( printf("Not a binary file!\n"); exit(); $) buf+=2; /* get past the header */ p}lace=buf; while(1) $( if((begin=getint(place))<0) break; /* end of file? */ end=getint(place+2); /* end of first mo}dule */ printf("\n%x - %x",begin,end); tmp=(end-begin)+5+place; if(tmp >= endbuf) break; /* end of file */ if}(getint(tmp) == 0xFFFF) $( printf(" *HEADER REMOVED*"); move(tmp+2,tmp,endbuf-tmp); endbuf-=2; $) i}f(getint(tmp) == (end+1)) $( /* compact it */ printf(" Compacted"); *(place+2)= *(tmp+2); *(place+3)= *(tm}p+3); move(tmp+4,tmp,endbuf-tmp); endbuf-=4; $) else place=tmp; $) close(iocb); copen(name,'w'); /*} Now we write out the compacted file */ buf-=2; /* this is to get the header discarded at the beginning */ bputs(buf,endb}uf-buf,iocb); putchar('\n'); exit();$)getint(where)char *where;$( if(where>endbuf) return -1; /* end of the file */} return dpeek(where);$)#include "D1:GETNAME.C"3/* CONFIG.C *//* Allows you to change density on a non-Atari drive */ #define SIO 0xE459#define DCB 0x300 char }*single,*double,*request,*send,data[12]; main() $( int drive; init(); /* initialize various code blocks */ while(}1) $( header(); /* print command summary */ switch(toupper(drive=getkey())) $( case '1': case '2': } read(drive-'0'); break; case 'W': write(); break; case 'Q': exit(); bre}ak; default: break; $) $)$) header() $( printf("\n 1-2 = read configuration\n"); prin}tf(" W = write configuration\n"); printf(" Q = quit, exit to DOS\n\n");$) init() $( single="\40\1\0}\18\0\0\0\128\255\255\255\255"; /* data for single density */ double="\40\1\0\18\0\4\1\0\255\255\255\255"; /* data for doub}le density */ request="\49\1\78\64\0\0\1\0\12\0\1\0"; send="\49\1\79\128\0\0\1\0\12\0\1\0"; dpoke(request+4,data); /* a}dd the address of the data table */ dpoke(send+4,data); /* add the address of the data table */ printf("\fCONFIG for LCD }DOS\n(1986) Ver. 1.00\n\n");$) write() $( int drive,density; printf("Drive to write density to (1 or 2)?\n");} if((drive=getkey()-'0')<1 || (drive>2)) return; printf("S -single density\nD -double density\nA - abort\n"); density=to}upper(getkey()); switch(density) $( case 'S': move(single,data,12); printf("Configure D%d: as single densit}y?\n",drive); if(toupper(getkey()) != 'Y') return badconfig(); break; case 'D': move(double,data,12); } printf("Configure D%d: as double density?\n",drive); if(toupper(getkey()) != 'Y') return badconfig(); break;} default: return; $) move(send,DCB,12); poke(DCB+1,drive); jsr SIO; read(drive);$) badconfig(}) $( printf("Configuration not written.\n");$) read(drive)int drive;$( move(request,DCB,12); poke(DCB+1,}drive); jsr SIO; if(peek(DCB+3)>1) $( printf("ERROR #%D reading D%d:\n",peek(DCB+3),drive); return; $) printf}("D%d: is %s density\n",drive,data[5]? "double":"single"); poke(0x1310+drive,(data[5])? 2:1); /* set the density within DOS} */$)  /* COPY.C *//* copy files, lock, unlock, rename, erase, batch */ #define SPACE 32 char file[20],new[20],command,*ptr,d }rive[10],names[16*64],tmp[30],ext[5]; main() $( command='C'; /* default command is copy */ while(getdos(file)) $( }normalize(file," "); if((file[4] == '.') && (file[5] == ' ')) $( /* is it a command? */ command=file[3]; if(! }getdos(file)) exit(); /* if no filename, then exit */ $) closeall(); normalize(file," "); switch(command) $( } case 'P': /* protect */ printf("Protecting %s\n\n",file); flock(file); break; case 'U': / }* unprotect */ printf("Unprotecting %s\n\n",file); funlock(file); break; case 'E': /* erase */ } printf("%s is erased\n",file); ferase(file); break; case 'R': /* rename */ if(getdos(ne }w)) $( ptr=new; while(*ptr != ':') ++ptr; *ptr=' '; printf("Renaming %s as%s\n",file, }ptr); strcat(file,ptr); frename(file); $) break; case 'C': copy(file); } break; case '-': /* chain everything following a - */ strcpy(0x680,file); *(index(0x680,"."))=0; } while(getdos(file)) $( strcat(0x680," "); strcat(0x680,file); $) chain(0x680); } break; default : printf("%c is an unkown command!\n\n",command); exit(); break; $) $) } exit(); /* no more from DOS */$) copy(fname)char *fname;$( int iocb,iocbin,iocbout,i,count,len; char *maxl }en,*buf; /* buf must be the last thing on the stack */ buf=lomem(100); /* a little safety room! */ maxlen=highmem()-buf; } if(!getdos(drive)) exit(); normalize(drive," "); /* so it works with all CIO's */ fname[1]=drive[3]; if(index(fname," }*")) $( /* multiple file copy? */ if((iocb=copen(fname,'d')) <= 0) $( printf("Can't open directory of %s\n",fname); } exit(); $) count=0; while(cgets(tmp,iocb)>0) $( /* read in the filenames */ strcpy(tmp,tmp+2); /* re }move lock/unlock code */ i=0; while((ext[i]=tmp[8+i])>SPACE) ++i; /* get the extension */ ext[i]=tmp[8]=0; } if((i=find(tmp,8,SPACE))>0) tmp[i]=0; /* end the primary with the first space if any */ normalize(tmp,ext); /* ad }d the extension */ tmp[1]=drive[3]; /* add correct drive number */ strcpy(names+count,tmp); /* put it in our tabl }e */ count+=16; $) count-=16; $) else $( /* single file only */ strcpy(names,fname); count=1; $) } if(!count) $( printf("Can't find %s\n",fname); return; $) for(i=0;i",fname); if((iocbin=fopen(fname,"r" }))>0) $( fname[1]=drive[4]; /* change the "to" drive number */ if((iocbout=fopen(fname,"w"))>0) $( printf }("%s\n",fname); do $( len=bgets(buf,maxlen,iocbin); bputs(buf,len,iocbout); $) wh }ile(len == maxlen); /* keep trying till the whole file is copied */ $) else if(iocbout == -167) printf(" ***file }locked***\n"); else printf(" error #%d\n",abs(iocbout)); $) else printf(" error #%d\n",abs(iocbin)); $) clo }seall();$)  /* CUBE.C *//* Draws 3D cubes */ int x,y,size,shade,bright,r,l,l1,xdif,ydif,i,delay,max;char text[20]; main() $( %} slow(); printf("\f\t3D CUBES\n\n\n"); printf(" change color\n erase\n set cube size\n clear screen\n"); %}printf("Press arrow keys to draw cubes.\n"); printf("Use joystick #0 to move the cursor.\n"); printf("\d\d\tPress a key t%}o start.\n"); getkey(); init(); /* initialize */ while(1) $( if((r=peek(764)) < 0xFF) $( if(r == 6) up(); %} else if(r == 7) down(); else if(r == 14) left(); else if(r == 15) right(); else if(r == 28) init(); /* e%}scape key, erase screen */ else $( r=getkey(); if(r == 'S') setsize(); if(r == 'E') erase(); %} if(r == 'C') $( /* change the color by one */ shade=(++shade) & 0x0F; fixcolor(); $) %}$) poke(764,0xFF); $) l=locate(x,y); l1=(++l1) & 3; /* cycle through 0-3 */ color(l1); plot(x,y); %} for(i=1;i159)%} x=0; if(y<0) y=95; if(y>95) y=0;$) setsize() $( graphics(7+32); /* add text without destroying screen */ prin%}tf("size? "); gets(text); size=atoi(text); max=(3*size)/5; graphics(7+16+32); /* restore the full screen */ fixcolo%}r();$) erase() $( /* enter erase mode */ int ersize,i,j; graphics(7+32); /* open text window */ printf("erase si%}ze?"); gets(text); ersize=atoi(text); graphics(7+16+32); fixcolor(); color(0); poke(764,0xFF); while(peek(764) %}== 0xFF) $( for(i=0;i9) continue; poke(0x155D,ival); break; )'} case 3: poke(0x155E,peek(0x155E) ^ 0xFF);/* flip whatever it was */ poke(0x41,peek(0x155E)); break; )(} case 4: printf("Background color="); if(!scanf("%d",&ival)) continue; /* break key? */ ))} poke(0x1560,ival); poke(710,ival); break; case 5: printf("Character brightness="); if()*}!scanf("%d",&ival)) continue; /* break key? */ poke(0x1561,ival); poke(709,ival); break; case 6)+}: poke(0x312C,peek(0x312C) ? 0:1); /* flip whatever it was */ break; case 7: exit();),} break; default: continue; $) $) while(1);$) (N/* DIR.C *//* This version allows you to redirect output to a printer by specifying P: as the first filename *//* globals u-.}sed for speed */ #define FILE int char *ptr,linebuf[100],tmp[64];int fcount;FILE iocb,out; main() $( out=0; /-/}* default output to screen editor */ if(!getdos(linebuf)) strcpy(linebuf,"*"); /* user didn't specify a filename, use a wil-0}dcard */ if(getdos(tmp)) $( /* printer flag? */ if(strchr(tmp,'P')) $( /* open the printer if specified on command line-1} */ while((out=fopen("P:","R"))<0) $( /* loop until we open the printer */ printf("Can't open printer\nTry agai-2}n (Y/N)?\n"); if(toupper(getkey()) != 'Y') $( out=0; /* default to screen */ break; /* exit while-3} loop */ $) $) $) $) normalize(linebuf,"*"); /* wildcard the extension if non specified */ if((iocb=c-4}open(linebuf,'d'))<0) $( /* open directory */ printf("Tried directory of %s\nGot an rrror #%d\n",linebuf,abs(iocb)); -5}exit(); $) poke(0x2F0,1); /* cursor off (speeds up listing to the screen */ putchar('\f'); /* clear the screen */ fco-6}unt=0; /* initialize file count at zero */ /* This is the main loop */ while(fgets(linebuf,iocb)>0) $( ++fc-7}ount; /* count the files read */ printf(out,"%s",linebuf); /* print the name, but no return */ if(out) printf(out," -8} "); /* send spaces if it's to the printer */ poke(0x55,20); /* move the cursor to column 2 */ if(fgets(linebuf,ioc-9}b)>0) $( ++fcount; /* count the files read */ fputs(linebuf,out); /* this time print the name with a return */ -:} $) $) poke(0x2F0,0); /* cursor back on */ printf(out,"%d-files.\n",fcount-1); /* number of filenames read */ if(out-;}) putchar('\n'); /* make sure cursor position is correct */ exit(); /* back to DOS */$) ,\/* FCALC.C *//* A simple floating point calculator */ main() $( char a[6],b[6],sum[6],c; /* a,b, and sum will be used a1=}s floating point numbers */ printf("\fA simple floating point calculator\n"); printf("Enter a number, a space or RETURN,\1>}n,an operator, a space or RETURN\n"); printf("and a second number.\nExample: 2 + 2 RETURN\n"); printf("Allowable operator1?}s are: +,-,/,*\n\n"); printf("Press BREAK key to quit.\n\n"); while(scanf("%f %c %f",a,&c,b) >= 0) $( /* BREAK key will r1@}eturn -128 */ switch(c) $( case '+': fadd(a,b,sum); break; case '-': fsub(a,b,sum); 1A} break; case '*': fmul(a,b,sum); break; case '/': fdiv(a,b,sum); break; 1B} default: printf("%c is an unkown operator.\n",c); continue; $) printf("%f %c %f = %f\n",a,c,b,sum)1C}; $)$)0 /* FILECMP.C *//* Compares two files */ int n1,n2,count,c1,c2,i,t1,t2;char name1[16],name2[16],f1[4],f2[4];main() $(5E} n1=getread(name1," "); /* open the two files for reading */ n2=getread(name2," "); fast(); /* screen off for speed */5F} printf(""); count=0; clear(f1,8); /* clear f1 and f2 */ while((c1=fgetc(n1))>=0) $( /* until end of file */ if(5G}c1 != (c2=fgetc(n2))) $( slow(); printf(" %d\n%s != %s\n %d != %d\t",count,name1,name2,c15H},c2); printf("'%c' != '%c'\n\n",c1,c2); for(i=0;i<4;++i) $( if((count<4) && (i$%x< ",c1); for(i=0;i<4;++i) if((t1=fgetc(n1)) >= 0) printf("$%x ",t1); 5J} putchar('\n'); for(i=0;i<4;++i) $( if((count<4) && (i$%x< ",c2); for(i=0;i<4;++i) if((t2=fgetc(n2)) >= 0) printf("$%x ",t2); printf("\n\n"); i5L}f((t1 >= 0) && (t2 >= 0)) $( printf("Continue?(Y/N)\n"); if(toupper(getkey()) != 'Y') exit(); else $(5M} count+=5; f1[3]=t1; f2[3]=t2; continue; $) $) exit(); $) 5N} ++count; move(f1+1,f1,3); move(f2+1,f2,3); f1[3]=c1; f2[3]=c2; $) if(fgetc(n2)>0) $( slow(); pri5O}ntf("%s %s\n",name2,name1); exit(); $) slow(); printf("%s == %s\n",name1,name2);$) #include "GET5P}NAME.C"4/* FSIZE.C - returns the size of a file */main() $( char name[20]; int iocb,len,divisor,k,rem; fast(); iocb=getread(9R}name," "); divisor= (peek(0x1311+(name[1]-'0')) == 2) ? 253:125; /* single or double density sectors */ inverse(name); /*9S} call routine to change the string to inverse */ len=bgets(0x5000,0xFFFF,iocb); closeall(); k=len/1024; rem=((len%1029T}4)*10)/1024; printf("\u\n%s\n%d.%dK %d sectors + %d bytes\n\n",name,k,rem,len/divisor,len%divisor);$) get9U}read(s,ext)char *s,*ext;$( int iocb; do $( getname(s); normalize(s,ext); if((iocb=copen(s,'r'))<1) print9V}f("Can't open %s\n",s); $) while(iocb<1); return iocb;$) getname(s)char *s;$( if(!getdos(s)) $( /* nothin9W}g was returned from DOS */ printf("Filename? "); slow(); if(gets(s)<1) $( printf("\u"); exit(); 9X}$) $)$) inverse(str) /* convert string to inverse */char *str;$( while(*str) $( *str |= 128; /* or in the9Y} inverse bit */ ++str; $)$) 8&/* GRAPHICS.C *//* graphics and game i/o */ #define SDMCTL 0x22F#define GRACTL 0xD01D#define CHBASE 0x2F4#define PMBAS=[}E 0xD407#define PLSIZE 0xD008#define HPOSPL 0xD000#define OLDCHSET 0xE000#define GRAF 0xD00D char *playbase,*charbase,=\}playsize;pminit() $( /* this must be called before any use of the following PM functions */ charbase=0xB400; /* NOTE: this=]} requires 48K! */ poke(PMBASE,0xB8); playbase=0xB800; poke(0x6A,0xB0); /* force highmem below player/missler area */ =^}graphics(0); move(OLDCHSET,charbase,1024); /* copy old character set into RAM */ poke(CHBASE,charbase>>8); /* character s=_}et is now in RAM where we can change it if we wish */$)pmflush() $( /* call this before returning to DOS to turn off PM gra=`}phics */ pmgraphics(0); /* turn off PM graphics */ poke(CHBASE,OLDCHSET>>8); /* restore the character set in ROM */ pok=a}e(0x6A,0xC0); /* raise the screen */ graphics(0);$)/* Set up PM graphics *//* i=0 > turns off PM graphics *//* i=1 > si=b}ngle line resolution *//* i=2 > double line resolution */pmgraphics(i)int i;$( int j; if(i) $( poke(SDMCTL,i==1 ?=c} 0x3E : 0x2E); /* enable DMA */ poke(GRACTL,3); playsize= (i==1) ? 8 : 7; clear(playbase,2048); playbase += (=d}i==1) ? 1024 : 512; for(j=0;j<4;++j) poke(HPOSPL+j,0); /* set horizontal position for any players off the screen */ $)=e} else $( poke(SDMCTL,0x22); poke(GRACTL,0); for(j=0;j<4;++j) $( poke(HPOSPL+j,0); poke(GRAF+j,0); =f} $) $) dpoke(0x312D,playbase); /* for pmload() */ dpoke(0x312F,playsize);$)/* define player width *//* width=0 > no=g}rmal width *//* width=1 > double normal width *//* width=3 > four times normal width */pmwidth(n,width)char n,width;$( =q}>bhDOS SYSblFCALC ACTb sRUNTIME ACTb FCALC ASMb BATCH C b1CB C b COMPACT C bCONFIG C bCOPY C bCUBE C bCUSTOM C b-DIR C b<FCALC C b DFILECMP C b QFSIZE C bZGRAPHICSC bHEXDMP C bHVAL C bISORT C b$LIFE C bMENU C bMGRDEMO C bPMDEMO C b QSORT C b SIEVE C b'SNAKE C b6SORTDIR C b UTYPE C b^WATFALL C bxDIR COMb|LIFE COMbLIFE LNKbMGRDEMO LNKbPMDEMO LNK LIFE CCCbLIFE OBJLIFE CCC }STDIO CCC poke(PLSIZE+n,width);$)pmclear(n) /* clear the player n */char n;$( clear(playbase+(n< used for defining and moving a pl=}ayer shape *//* The first value of shape should contain the length. *//* The second and last values should be \0 to clear p=}revious value when moving the shape by one */pmload() asm 0x310B; /* (n,x,y,shape) n is player number */<j/* HEXDMP.C *//* Display a file in hex and ascii */ int iocb,place; main() $( int newplace,i,j,count,tmp; chA}ar name[20],hold[8],*addr; closeall(); addr=lomem(10); iocb=getread(name," "); printf("\fhex >>> %s <<<\n\nA}",name); newplace=place=0; goto start; /* begin with place zero */ while(1) $( position(0,20); poke(752,0); /* A}cursor on */ printf("Enter place ('.' if decimal) -,+ okay\n"); if((newplace=getnum()) == -1) break;:start poke(A}752,1); /* cursor off */ if(newplaceplace) bgets(addr,newplace-place,iocb); /* ignoA}re until newplace */ if(status(iocb) == 136) close(iocb); /* end of file *//* if we reached the end of the file, then clA}ose it to force an error with cgetc */ place=newplace; printf("\fhex >>> %s <<<\n",name); for(i=0;i<16;++i) $A}( printf("%x- ",place); place+=8; for(count=0;count<8;++count) $( /* output 8 hex digits */ if((tmpA}=fgetc(iocb))<0) break; /* end of file */ if(tmp == 155) hold[count]='.'; /* don't send a return character */ A} else hold[count]=tmp; printf("%x ",tmp); $) position(32,i+1); poke(0x2FE,1); /* display control coA}des */ for(j=0;j= 'A') && (c <= 'F')) v=(v<<4)+(c-55); else break; $) return v;$) A} #include "GETNAME.C"@hval(s) /* hex string to integer */char *s;$( int v; char c; v=0; while((c=toupper(*s++))) $( if(isnumeric(c)) E}v=(v<<4)+(c & 0xF); else if((c >= 'A') && (c <= 'F')) v=(v<<4)+(c-55); else break; $) return v;$)Do/* ISORT.C *//* sort a file using insertion sort routine */ #define NRECORDS 500 /* maximum number of lines */#define I}MAXLEN 10*1024 /* size for file */#define EOL 155#define FILE int main() $( char file_in[64],file_out[64]; int addrI}[NRECORDS]; int count,len,i; char *buf,*ptr,*endptr; FILE iocb; title(); /* send title screen */ buf=malloc(MI}AXLEN); if (!buf) error("Cannot allocate enough memory for",file_in); /* print msg and exit */ if(!getdos(file_in)) $( I} printf("Enter file_in to sort:"); gets(file_in); $) fast(); normalize(file_in," "); /* add default drive */ if I}((iocb=fopen(file_in,"r")) < 1) $( printf("Can't open %s\n",file_in); exit(); $)/* Read in all at once. This is MI}UCH faster then a line at a time! */ len=fread(buf,1,MAXLEN,iocb); if (len >= MAXLEN) $( printf("Cannot allocate enouI}gh memory for %s\n",file_in); /* print msg and exit */ error("Not enough memory for",file_in); $) fclose(iocb); endI}ptr=buf+len; for(ptr=addr[0]=buf, count=1; ptr128) && ptr0) $( a[j]=a[j-1]; --j; $) a[j]=v; $) $) HU/* LIFE.C */ #define MODE 21 /* graphics mode 5 */#define XMAX 79#define YMAX 47#define SIZE 5100 char c,ex[10M}00],ey[1000],nx[1000],ny[1000],tx[SIZE],numb[10],change;int ncells,x,y,d,t,col,z,xmin,xmax,ymin,ymax,e,n,count,xt,yt,cell; M} main() $( printf("\f\d\d\tThe game of LIFE\n\n"); printf("Use joystick #1 to move one cell\n at a time.\n"); prinM}tf("Use arrow keys (without control key)\n followed by a number to move more\n"); printf(" than one cell\n"); printf("PM}ress Ġ to move diagonally\n"); printf("\d will turn cursor off (erase mode)\n"); printf(" will turn cursor on.\n\M}nPress space bar to start, or to stop.\n"); position(2,22); printf("Press space to begin.\n"); getkey(); graphics(MODM}E); dpoke(0x80,tx); dpoke(0x82,&x); dpoke(0x84,&y); dpoke(0x86,&cell); while(1) $( /* place ncells */ clear(&c,M}&change-&c); poke(764,255); x=xmax=xmin=XMAX/2; y=ymax=ymin=YMAX/2; count=change=0; z=3; graphics(MODM}E-16); /* allows text window */ position(0,0); while(!inkey()) $( col=0; while((d=stick(0)) == 15 && peekM}(764) == 255) $( color(col++); col=col&3; plot(x,y); if(change != z) $( /* print only if coloM}r is changed */ if(z == 0) printf(">>off<<\n",cls()); else printf(">>on<< \n",cls()); change=M}z; $) $) color(z); plot(x,y); tx[(x<<6)+y]=z; if(d<15) $( if(z == 3) adjust(); M}/* check for x and y boundaries */ for(t=0;t <= 300;t++); place(d); continue; $) c=getkeyM}(); if(c == '<') $( z=0; continue; $) if(c == '>') $( z=3; continue; M}$) if(c == ' ') break; d=15; if(c == '+') d=11; if(c == '*') d=7; if(c == '-') d=14; if(cM} == '=') d=13; if(c == 'D' || c == 'd') $( printf("Press arrow key to indicate direction."); c=getkey()M}; if(c == '+') d=111; if(c == '*') d=17; if(c == '-') d=114; if(c == '=') d=113; $) M} printf("Press number, or '.' if greater than 9.\n",cls()); if((n=getkey()) != '.') n-='0'; else $( priM}ntf("Number?"); gets(numb); n=atoi(numb); $) color(z); for(t=0;txmax) xmax=x; if(yymax) ymax=y;$) life() $(/* change ncells */ poke(764,255);M} graphics(MODE+32); while(!inkey()) $( e=n=0; yt=ymax+2; xt=xmax+2; for(y=ymin-1;y4)) $(M} ex[e]=x; /* erase cell due to overcrowding */ ey[e++]=y; $) else if(ncells == 3) $( M} nx[n]=x; /* new cell or keep the old cell */ ny[n++]=y; $) $) $) if(n) ++count; elsM}e $( graphics(MODE-16); /* allows text window */ printf("%d generations\n",count); printf("\nPress space toM} continue\n"); getkey(); return; $) color(0); for(t=0;txmax) xmax=c; if((c=ny[M}t])>ymax) ymax=c; else if(cYMAX-2) ymaxM}=YMAX-2; if(xmax>XMAX-2) xmax=XMAX-2; $)$) kount() asm 0x600; place(data)int data;$( switch(dataM}) $( case 11: --x; break; case 7: ++x; break; case 13: ++y; break; case 1M}4:; --y; break; case 111: --x; ++y; break; case 17: ++x; ++y; break;M} case 113: --y; ++x; break; case 114: --y; --x; break; default: break; M} $) if(x<1) x=1; if(y<1) y=1; if(y>YMAX) y=YMAX; if(x>XMAX) x=XMAX;$) LR/* MENU.C *//* This program lists a menu of *//* ".COM" files, and allows the *//* user to select whQ}ich file *//* to run. */ main() $( int iocb,place,count,i,j,k,lfmargin; char dirname[20],tQ}mp[20],filename[17*64]; if(!getdos(dirname)) strcpy(dirname,"*"); /* default if user doesn't specify */ if((i=strchr(dirnQ}ame,'.')) > 0) dirname[i]=0; /* don't allow any extentions */ normalize(dirname,"COM"); if((iocb=copen(dirname,'d')) < 0)Q} $( printf("Can't open directory of %s\n",dirname); exit(); /* fatal error, so return to DOS */ $) count=0; whiQ}le(cgets(tmp,iocb) > 0) $( /* read all the matching filenames */ strcpy(filename+count,dirname); /* start with the drive Q}*/ for(place=3,i=2;i<=10;++i) $( /* add the primary name */ if(isspace(tmp[i])) break; /* stop if it's a space */ Q} else filename[count+(place++)]=tmp[i]; $) filename[count+place]=0; /* end of the string */ strcat(filename+cQ}ount,".COM"); /* add the extension */ /* Use the following line as a template to remove any files you don't want to incQ}lude in the menu */ if(index(filename+count,":CC.COM")) continue; else count+=17; /* next filename */ $Q}) count-=17; /* remove the FREE SECTORS */ closeall(); if(!count) $( printf("NO FILES!\n"); exit(); /* Can't doQ} a menu with no files! */ $) /* Now we print the menu */ putchar('\f'); /* clear the screen */ lfmargin=peeQ}k(0x52); /* in case there's two columns */ for(place=i=0;i<26 && place count/17)); /* untQ}il we get the correct input */ chain(filename+((i-'A')*17)); /* go run it! */$) PX/* MGRDEMO.C *//* Demonstrate MGR graphics */ int x,y,nx,ny,x2,y2,nx2,ny2,xmove,ymove,xc,yc,radius,i; #define SIZE U}20 main() $( xc=80; yc=48; graphics(7+16); while(1) $( /* plot() demo */ color(1); for(y=0;y<96;y+U}=2) for(x=0;x<160;x+=2) plot(x,y); mcolor(3); for(y=0;y<96;y+=2) for(x=0;x<160;x+=2) mplot(x,y); mcolor(0); fU}or(y=0;y<96;y+=2) for(x=0;x<160;x+=2) mplot(x,y); /* drawto() demo */ color(1); for(x=0;x<160;++x) $( plotU}(x,0); drawto(x,95); $) for(i=0;i<3;++i) $( mcolor(3); for(x=0;x<160;++x) $( mplot(x,0); U} mdrawto(x,95); $) mcolor(0); for(x=159;x >= 0;--x) $( mplot(x,0); mdrawto(x,95); U} $) $) /* circle() demo */ for(i=0;i<2;++i) $( color(1); for(radius=4;radius<48;radius+=4) circle(xU}c,yc,radius); mcolor(0); for(radius=4;radius<48;radius+=4) circle(xc,yc,radius); $) for(i=0;i<10;++i) $(U} mcolor(3); for(radius=4;radius<48;radius+=4) mcircle(xc,yc,radius); mcolor(0); for(radius=4;radius<48U};radius+=4) mcircle(xc,yc,radius); $) /* box() demo */ for(x=0;x<10;++x) $( mcolor(3); for(i=4;i<96/U}2;i+=4) mbox(80+i,48+i,80-i,48-i); mcolor(0); for(i=4;i<96/2;i+=4) mbox(80+i,48+i,80-i,48-i); $)/* fill demoU} */ mcolor(1); mplot(80,0); mdrawto(159,95); mdrawto(0,95); mdrawto(80,0); color(1); plot(80,0);U} fill(1,94,1); mcolor('\f'); mcolor(3); mplot(80,0); mdrawto(159,95); mdrawto(0,95); mdrawto(80,0)U}; mvfill(80,94); clrtime(); while(gtime() < 60); mcolor(2); mcircle(80,48,40); mvfill(80,48); mcoU}lor(1); mplot(50,28); mdrawto(110,28); mdrawto(90,48); mdrawto(110,68); mdrawto(50,68); mdrawto(70,48U}); mdrawto(50,28); mfill(80,48); clrtime(); while(gtime() <60); mcolor('\f');/* filled box demo */ nU}x=160/2; ny=96/2; nx2=nx+SIZE; ny2=ny+SIZE; xmove=-5; ymove=-5; for(i=0;i<300;++i) $( x=nx; y=ny; U} x2=nx2; y2=ny2; nx+=xmove; ny+=ymove; nx2=nx+SIZE; ny2=ny+SIZE; if(nx < 6) xmove=5; else if(nx >U} 153-SIZE) xmove=-5; if(ny < 6) ymove=5; else if(ny > 89-SIZE) ymove=-5; mcolor(0); mfbox(x,y,x2,y2);U} mcolor(3); mfbox(nx,ny,nx2,ny2); $)/* face demo */ mcolor(2); mcircle(160/2,96/2,94/2); mvfill(U}160/2,96/2); mcolor(0); mcircle(60,96/3,10); mfill(60,96/3); mcircle(100,96/3,10); mfill(100,96/3); mU}fbox(60,60,100,70); for(i=0;i<50;++i) $( mcolor(1); for(radius=2;radius<10;radius+=2) $( mcircle(60,9U}6/3,radius); mcircle(100,96/3,radius); $) mcolor(0); for(radius=2;radius<10;radius+=2) $( mU}circle(60,96/3,radius); mcircle(100,96/3,radius); $) $) $)$) fill(x,y,c)int x;char y,c;$( U} poke(765,c); dpoke(85,x); poke(84,y); return ciov(6,18,-1,-1,-1,-1); $) mcolor() asm 0x4004;mplot() asm 0U}x4007;mdrawto() asm 0x400A;mlocate() asm 0x400D;mfill() asm 0x4010;mcircle() asm 0x4013;mbox() asm 0x4016;mfbox() asm 0U}x4019;mvfill() asm 0x401C;T/* PMDEMO.C *//* Demo of the player/missile graphics */ int x[4],y[4],dx[4],dy[4],shape[4],n; /* we use globals becauZ}se they are faster than locals */main() $( char i; poke(764,255); /* get ready to look for a key press */ pminit(); /*Z} initialize player-missle graphics */ pmgraphics(1); /* single line resolution */ poke(710,0); /* background black */ pZ}utchar('\f'); /* clear the screen */ poke(0x2F0,1); /* turn off the cursor */ position(10,9); printf("A PM Graphics DemZ}o\n"); position(10,10); printf("(look at PMDEMO.C)\n"); position(9,12); printf("Press to start.\n"); positionZ}(9,13); printf("Press a key to quit."); for(i=0;i<4;++i) $( pmcolor(i,4*i,8); /* define the colors */ pmwidth(i,0Z}); /* normal width */ $) ballhack(); pmflush(); /* clear player missle graphics */ poke(764,255); /* clear the key */Z} exit();$) ballhack()$( shape[0]="\10\0\0\0\0\0\0\0\0\0\0"; shape[1]="\10\0\0\0\0\0\0\0\0\0\0"; shape[2]="\10Z}\0\0\0\0\0\0\0\0\0\0"; shape[3]="\10\0\0\0\0\0\0\0\0\0\0"; for(n=0;n<4;++n) $( x[n]=105+(11*n); y[n]=80; whilZ }e(!(dx[n]=rand(3)-1)); /* randomly select directions */ while(!(dy[n]=rand(3)-1)); $) chget('d',shape[0]+2); chget(Z }'e',shape[1]+2); chget('m',shape[2]+2); chget('o',shape[3]+2); for(n=0;n<4;++n) pmload(n,x[n],y[n],shape[n]); /* load tZ }he shape */ while(console() != 1); /* wait for to be pressed */ while(!inkey()) $( /* until a key is pressed */Z } for(n=0;n<4;++n) $( pmload(n,x[n],y[n],shape[n]); /* move the shape */ x[n]+=dx[n]; /* add the directions */Z } y[n]+=dy[n]; if(x[n]<41) $( dx[n]=1; continue; $) if(x[n]>200) $( dx[n]=-1;Z} continue; $) if(y[n]<32) $( dy[n]=1; continue; $) if(y[n]>223) $( dy[Z}n]=-1; continue; $)/* if we were looking for who we collided with, we would use hitpl(who,hitwho) */ if(Z}hitpl(n,-1)) $( /* did it hit anyone? */ dx[n]=rand(3)-1; /* new directions */ while(!(dx[n]=rand(3)-1)); Z} while(!(dy[n]=rand(3)-1)); y[n]+=dy[n]; pmload(n,x[n],y[n],shape[n]); pmclear(n); chget(Z}rand(127)+1,shape[n]+2); /* new shape drawn from character base */ hitclear(); $) $) $)$) Xr/* CSORT.C *//* sorts lines using quicksort routine - removes duplicate lines */ #define LINES 2000 /* maximum number ^}of lines */ int gap,i,j,dif,*lineptr[LINES];char *temp; main() $( char fname[20],*addr; int nlines,iocb,len,^}i; iocb=getread(fname," "); fast(); nlines=readlns(iocb); /* read in the lines */ printf("%d lines read\n",nlines); ^} while(sort(nlines)) --nlines; /* sort the lines */ printf("%d lines sorted\n",nlines); fclose(iocb); if((iocb=fopen(fn^}ame,"w"))<0) $( printf("can't open %s\n",fname); exit(); $) for(i=0;i 0;gap/=2) $( for(i=gap;i= 0;j-=gap) $( if(!(dif=strcmp(lineptr[j],lineptr[j+gap]))) $( printf("'%s' is a duplicate\n"^},lineptr[j]); lineptr[j]=lineptr[n-1]; return 1; /* indicate two records were the same */ $)^} if(dif<0) break; temp=lineptr[j]; /* swap the pointers */ lineptr[j]=lineptr[j+gap]; lineptr[^}j+gap]=temp; $) $) $) return 0; /* indicate sort is done */$) readlns(iocb)int iocb;$( int len^},count; char *addr; addr=lomem(100); /* beginning of text space */ for(count=len=0;len >= 0;++count) $( lineptr[cou^}nt]=addr; /* save the pointer */ len=cgets(addr,iocb); addr+=(len+2); $) return --count;$) #include "GE^}TNAME.C"\ /* PRIME.C *//* The sieve of Eratoshenes Prime number benchmark */ #define TRUE 1#define FALSE 0#define SIZE 8190#defib!}ne COUNT 10 char flags[SIZE+1]; main() $( int i,prime,k,count,iter; printf("%d iteration%s\n",COUNT,(COUNT == 1) ? b"}"." : "s."); fast(); /* turn off the screen */ clrtime(); /* reset the system clock */ for(iter=1;iter <= COUNT;++iter)b#} $( count=0; for(i=0;i <= SIZE;++i) flags[i]=TRUE; /* could use setblock(flags,SIZE,1); */ for(i=0;i <= SIZE;++i)b$} $( if(flags[i]) $( prime=i+i+3; for(k=i+prime;k<=SIZE;k += prime) flags[k]=FALSE; ++count; b%} $) $) $) k=gtime()/60; /* time in seconds */ slow(); /* turn on the screen */ printf("%d primes in %d seconds\b&}n",count,k);$)`/* SNAKE.C */ main() $( int s,x,y,zx,zy,z,sc,hs; slow(); printf("\fThe object of this game is to draw\nthe line tf(}hough as many boxes as\n"); printf("possible without touching the line\nor the border.\n\n\n"); printf(" Press butf)}ton to start.\n"); while(strig(0)); sc=hs=0; while(1) $( graphics(11); poke(710,0); /* screen black */ zx=1f*}; zy=0; x=40; y=90; color(10); /* draw the border */ plot(0,0); drawto(79,0); drawto(79,191); f+} drawto(0,191); drawto(0,0); box(); while(1) $( /* while no collision with self or border */ z=locate(x,y);f,} if((z == 10) || (z == 5)) break; /* collision with self or border */ color(5); plot(x,y); if(z == 15f-}) $( /* hit a box */ sc+=10; box(); /* draw a new box */ $) s=stick(0); if(s<15) $( /* joysf.}tick was moved */ if((s == 14) && (!zy)) $( zx=0; zy=-1; $) if((s == 13) && (!zy)f/}) $( zx=0; zy=1; $) if((s == 11) && (!zx)) $( zx=-1; zy=0; $)f0} if((s == 7) && (!zx)) $( zx=1; zy=0; $) $) for(z=1;z<100;++z); /* slow down!f1} */ x+=zx; y+=zy; ++sc; if(zx != 0) for(z=1;z<170;++z); /* slow down horizontal which is faster than f2}vertical */ $) graphics(0); /* end of the game */ poke(710,0); position(5,7); printf("score= %d\thighest f3}= %d\n",sc,hs); if(sc>hs) hs=sc; sc=0; printf(" Press button to play again\n"); while(strig(0)); $)$) f4} box() $( /* draws a random box */ int a,b; a=rand(69-5)+5; b=rand(179-5)+5; color(15); plot(a,b); drawtof5}(a+2,b); drawto(a+2,b+2); drawto(a,b+2); drawto(a,b);$) dB/* spartsrt.c - sorts sparta dos directory */ int iocb,drive,flag,pos,i,count,ext,a[130],v,j,k,offset,del,left;char wildj7}sub[14],buf[130*24],sub[16],path[64],dir[4]; main() $( while(1) $( title(); strcpy(wildsub,"D1:*."); strj8}cpy(sub,"D1:"); strcpy(dir,"D1:*.*"); strcpy(path,"MAIN>"); printf("堣Π"); whij9}le((drive=getkey()) < '1' || (drive != 155 && drive>'8')); if(drive == 155) exit(); putchar(drive); putchar('\n')j:}; wildsub[1]=drive; dir[1]=drive; sub[1]=drive; iocb=1; do $( clear(path+5,58); ciov(iocb,48,j;}dir,path+4,0,0); path[strlen(path)-1]=0; /* remove trailing EOL */ printf("\f %s\n\n",path);j<} iocb=copen(wildsub,'d'); if(iocb<1) fatal("Can't open directory"); for(pos=0;fgets(buf+pos,iocb)>1;) $( j=} if(buf[pos+10] != ' ' && buf[pos] < '0') $( buf[pos+13]=0; printf("%s\n",buf+pos); pos +=j>} 24; $) $) fclose(iocb); flag=1; printf("\nPress RETURN to use current directory\nEnter < to j?}move up one directory,\n"); printf("or enter subdirectory name\n\n>"); if(gets(sub+3)) ciov(iocb,44,sub,0xFF,0,0)j@}; /* change working directory */ else flag=0; $) while(flag); printf("\f1) Sort by filename\n2) Sort by extjA}ension\n\n>"); while((i=getkey()) < '1' || i>'2'); ext= (i == '1') ? 0:1; printf("\n\u%s\n",(i == '1')?"jB}":""); i=ciov(iocb,3,dir,0xFF,20,128); if(i<1) $( printf("Error %d\n",abs(i)); fatal("OperatjC}ion aborted"); $) offset=6; for(del=count=pos=0; bgets(buf+pos,23,iocb)>0; a[count++]=buf+pos+offset,pos+=24); jD} fclose(iocb); putchar('\n'); for(i=pos=0; i'); bputs(a[i]+6,8,0); putchar('.'); bputs(a[i]+14,3,0); putchar('\n'); $) $jJ}) for(del=i=0; i= fall;--x) $( color(rndcol()); plot(x,y); $) /* next x */ $) /* next y */ cflag=1;ri} for(fall=0,x=58;x <= 66;++x) $( plot(x,25+(fall++)); for(y=30;y <= 120;y+=4) $( color(rndcol()); drawtorj}(x,y+fall); $) $) color(6); plot(58,28); drawto(58,25); drawto(59,25); plot(66,38); drawto(66,129); colrk}or(7); plot(73,33); drawto(79,33); plot(68,34); drawto(79,34); cflag=1; for(y=121,fall=57;y <= 128;++y,++fall) $(rl} for(x=fall; x; --x) $( color(rndcol()); plot(x,y); $) $) for(t=0;t <= 20;t+=2) $( x=data[t]; rm} y=data[t+1]; color(8); for(i=0;i <= 2;++i) $( plot(x-i,y-40+(2*i)); drawto(x-i,y-20-(2*i)); $) rn} for(i=-2;i <= -1;++i) $( plot(x-i,y-40-(2*i)); drawto(x-i,y-20+(2*i)); $) color(6); plot(x,y); ro} drawto(x,y-21); color(5); plot(x,y+1); drawto(x+7,y+4); plot(x+8,y+3); drawto(x+8,y+5); drawto(x+9,yrp}+6); drawto(x+9,y+3); drawto(x+10,y+3); drawto(x+10,y+7); plot(x+11,y+7); drawto(x+11,y+4); drawto(x+rq}12,y+5); drawto(x+12,y+7); color(8); for(i=1;i <= 15;++i) $( while((rx=x+rand(7)-3) == x); ry=y+rand(rr}8)-3; plot(rx,ry); $) $) color(0); plot(57,114); drawto(65,122); plot(57,115); drawto(65,123); plotrs}(57,116); drawto(65,124); plot(56,116); drawto(65,125); plot(56,117); drawto(65,126); plot(56,118); drawto(65,1rt}27); plot(56,119); drawto(65,128); plot(55,119); drawto(64,128); plot(55,120); drawto(63,128); for(i=0;i <= 3;+ru}+i) $( sound(i,i*50,0,8); $) delay();$) dofill() $( plot(x1,y1); fill(x2,y2);$) rndcol() $( while(rv} (col=rand(4)+1) == stcol); stcol=col+cflag; if(stcol == 0) stcol=4; else if(stcol == 5) stcol=1; return col;$) rw}fill(x,y)int x;char y;$( dpoke(85,x); poke(84,y); return ciov(6,18,-1,-1,-1,-1); $) pa0@A7@yBrr0r0 rr0r0 r0 wBA0O@AcA 03B0&@3BP61&@eAhA*@ wvy}Bf@jA0030B0Ye@ wB$@$e@AA?0Ad0 uBf@AAuB0000K0}-0 sBAuB90h6A^sBvz}wBAA00wB& AwBA00UK0AuB90h@^sBAwB<0$@K0wBAsB.00wB&^A-00 *P:RCv{}an't open printerTry again (Y/N)?*Tried directory of %sGot an rrror #%d%s %d-files.tb0@,H7@krr0r0 rr0r0 r0 PF00gF00F00F00F00G007G000z}}xG00300WQ0kQ0kQ0kQ0&8C-Hk-H.u0K0' k k k k k kk k k.0z~}001C k0 kAH0H&pA`k0k: kkk0kkJ&Ak[AG9C00$gAG9C00kz}k$Ak0kk0Wk>pk,k kAkAAC kk-A$A`k$A$AkE$@30-H-H<A k$@-H>z}A k$@-H A$1C k-H+B k-H*B k-H-)B k-H=6B k-HDHGB-HdH&BG0030-H-H+eBo kz}-H*rB k-H-Br k-H=Bq kG9C0030 k.Bk0. k$BG00k60kW0 kk0 kkk@$Bz}kBkEkCkk0Wk>pk,k ACWk>pk,k $B$@zC$@ G00 kkOCk kkk]Ck kz}kkkCk kkkyCk k K0 ,00E k kk kk kk. kkk?D$CkCk. kkkC$Cz}kC kk&CkLCkP&D.Hpkk L`k,k $Ck9DOpkk S`k,k $C$Ck&JDkkD.0Hz}k00H0030 0 kkkD$DkuD.HpkLpk0W.Hpk>Lpk,, $DO k kS k k0 kz}kkdE$DkDOpkSpk0WOpk>Spk,, Opk-Hk-E-H k$;E-Hk;E-H kSpk-HkSE-H k$Dz}-HkaE-H k$DkpE kk|E kkh-E- kkhMCM k$C \ E$Ebk$F\E$EkF\ E$EkF\E$Ebkz}$F\oE$EbkkF\E$E^kkF\qE$FbkkF\r F$Fbkbk$F$F$F$Fk)F kk5F kkh/BF/ kkhOOFO z}k }The game of LIFEUse joystick #1 to move one cell at a time.Use arrow keys (without control key) followed by az} number to move more than one cellPress Ġ to move diagonally will turn cursor off (erase mode) will turn cuz}rsor on.Press space bar to start, or to stop.Press space to begin.>>off<<>>on<< Press arrow key to indicate direcz}tion.Press number, or '.' if greater than 9.Number?%d generationsPress space to continueo Bz} B B B B B B B B B`JfJfee損iej`ontinueo Bx`stdiolifelife.obj|-47CEmgr.objmgrdemostdiodvcload.obj(pmdemographicsstdio)' *'  *' F *' *' *' *' *'   +' ( *','  -' } ' .' ' .' ' .' (' .'  ' ' ' /'  0' '' '}' !'"'' '%' '   -' +'1' $ ' 2'' $ }%  3' $ %'"'# 4'' '' ' 5'' '% ' $ ? 6' }*' I 6' *' '' ' 4'' ' 5' ' '  ' '' & '} $ 7' '' ,''"'#' 8' ,''' <$ '}' >$ '' $ '' +$ '' *$ '' -$} '' =$ '' D$ % ' d$ % S *',''' +$ o}'' *$ '' -$ r'' =$ q' z 6' *','$' .%$' } 0$'   *' ' 9' ' :'$' ' 4' '!' $'&"$#'"'!$' 8'}' $%' ' 5' ' '  ' '7'% ' '  ' '#";'}6'  *'7'' '&&''&'  '('' ''' !'&('!'(' "'()'"');' } 0'   -'*1' $+ $'#'"' '' ' &'!' ',' ''&-/.}'"',/' '0' &'&132'"'03<''(' %5' & % 6' (} %6 %54 ' #' ' ' #'"#'# '74' $8 ' $' ' ' $'"$'# '87}21.-$'9%'"%':9   -'  %' *'  *',': 4' ';' #'&}<>='"';> ' ' ' ' 5' ' ' '  ' ' =< '' ' '}!'"'  4' '?' $'&@BA'"'?B ' ' ' ' 5' ' ' '  ' }'  ' '' '&C''DC'  '(E' 'ED ' '' "'(F'"'GF' }!'&H'!'HGA@' &I 'I!' &J !'J"' -(K -"'K ' M(L M} 'L*+<'8' . NON'#'MPO.PQP'"'MRQ. RSR'"'M}TS.TUT'#'MVU.oVWV'#''"'MXW.XYX'"''"'MZY}.qZ[Z'#''"'M\[.r\]\'#''#'M^]_^M`_^`M' &}` '`' &a 'a' /(b /'b' O(c O'c}The game of LIFEUse jo}ystick #1 to move one cell at a time.Use arrow keys (without control key) followed by a number to move more than one} cellPress Ġ to move diagonally will turn cursor off (erase mode) will turn cursor on.Press space bar to sta}o B B B B B B B B B B`JfJfee損iej`vrt, or to stop.Press space to begin.>>off<<>>on<< Press arrow key to indicate direction.Press number, or '.' if gr}eater than 9.Number?%d generationsPress space to continue''''''' ''}''''''' '!'"'#'$'%'&'''(''c'ex'ey'nx'n}y'tx'numb'change'ncells'x'y'd't'col'z'xmin 'xmax!'ymin"'ymax#'e$'n%'count&'xt}''yt('cell)'main*'printf+'position,'getkey-'graphics.'dpoke/'clear0'poke1'inkey2'stick3'peek4'colo}r5'plot6'cls7'adjust8'place9'gets:'atoi;'life<'kountdpoke/'clear0'poke1'inkey2'stick3'peek4'coloE'B=K '' KD$ ' Kd$ S*','''B+Ko''B*K''B-}Kr''B=Kq' z6' *','$'C.$' K0$'  *' '9' ':'$' }' 4'L'!'D$'$#T'!$' 8''B%' ' 5' '' K8' '7'% '}' K8' '#";'6' *'7''D'&''&'E ''' '''D!'('!'}('E"')'"');' M0'MK  -'*1' +L$'#'"'N'' 'N&'!' K','D''}-/.T',/' K'0'D&'.32T'03<''('5' K& 6' K(654 '8#' }' '0#' '24'B8 '8$' ' '0$' '8721.-$'9T%':9MK -' %' }*' *',':M4'L';'D#'<>=T';> '8' '8' 5' ' '8' K '8'} L=< '' ' '!'"'M4'L'?'D$'@BAT'?B '8' '8' 5' ' '8' K} '8' K '8''D'C''DC'E 'E' 'ED '8''E"'F'"'AF'D!'H}'!'HGA@R'IK'IR!'JK!'J"'4-KK-"'K '4M*KM 'L*+,8'A. }NON1'MO.PQPT'MQ. RSRT'MS.TUT1'MU.oVWV1'T'MW.}XYX/'T'MY.qZ[Z1'T'M[.r\M\1'1'M]M^M_M`MR'`K'}`R'aK'a'4/bK/'b'4OcKO'c}The game of LIFEUse joystick #1 to move one cel}l at a time.Use arrow keys (without control key) followed by a number to move more than one cellPress Ġ to move }diagonally will turn cursor off (erase mode) will turn cursor on.Press space bar to start, or to stop.Press sp}ace to begin.>>off<<>>on<< Press arrow key to indicate direction.Press number, or '.' if greater than 9.Number?}%d generationsPress space to continue''''''' ''''''}''' '!'"'#'$'%'&'''(''c'ex'ey'nx'ny'tx'numb'change}'ncells'x'y'd't'col'z'xmin 'xmax!'ymin"'ymax#'e$'n%'count&'xt''yt('cell)'main*'}printf+'position,'getkey-'graphics.'dpoke/'clear0'poke1'inkey2'stick3'peek4'color5'plot6'cls7'adjus}t8'place9'gets:'atoi;'life<'kountdpoke/'clear0'poke1'inkey2'stick3'peek4'color5'plot6'cls7'adjus,''''''' '!'"'#'$'%'&'''(''c'ex'ey'nx'n}y'tx'numb'change'ncells'x'y'd't'col'z'xmin 'xmax!'ymin"'ymax#'e$'n%'count&'xt}''yt('cell)'main*'printf+'position,'getkey-'graphics.'dpoke/'clear0'poke1'inkey2'stick3'peek4'colo}r5'plot6'cls7'adjust8'place9'gets:'atoi;'life<'kountdpoke/'clear0'poke1'inkey2'stick3'peek4'coloE