@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% }Dž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}GCEDC0X:Ȣ Y ȱC* ? 0.. , 0%n ?A[ 0 : L`L  `, 0`Y}`piH n0)բY? 08`0 }  0$L GGȽG L `8L`L}Nj8`  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( ySYS IIIIIIIIIIIIIIIC`0 ߩ0}}0~}EwC '+/>;;PVDOSDOS[ `SYS sx}~}/7}<=nx433~} CDOS SYS~} densitydoublesingle0r0 rr0r0 r0 @&@@|30B0\1`@\2`@$o@0.A$}=@\WB'!"ԩ L:!!BL>3U J ]L!T  LLLLLLLLL}LLLL }rLL[ T`HIB VL$`lllLLLLD1:D:STARTUP.EXCP.EXCD1:DCOPY.COMCOMyy~!}R@DCOPYN.SYSM 41 BATCH.COM 41 RAMLOAD.COM 42 BATCH.COM 42 14 FASTER.COM 14u+"}]++L-5  LQ_t_"~#Z [䝀5iUiVifigi#}ǍOiP$ic%ido \X ^AXR`aLH Th78`!" ' IL$}G< 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}DZ…ť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}CnȝK)IJL_"S:_A [ a{`` " ȈȈ`҈ұ) ƝҠ)r Ƞ)7}7ǝ`ƙȥ`ː"ʐ̱ȑ`eͅeͅˤȑʈȑʥˈ``8}Ǫ``` `ƅɈƅȹɛȩ`0:`` G `! *qHqƪh`L!lȱňı89}N8必ƥDZ…ȱ…ťi !ԆL7 !H !h` T`* bLb"R `ƅˈƅʈƅɈƅ` !ƝB :}eEƝD IƝH ƝJ ƝK V Ii`` !L!BHIL_"ȱi G"F"";}" Lb" "ձʑ `ƙȄͦʥ``ƅɈƅȢ`ƅȱƅ̠ƅȱȪ̑Ȋ` <}"HȱȪh` "ȅȱȅͥˑȥʈȦͥ`ƅƅ إԅ) ٥0Ԧ`IIi`eԅԐL6e !ƙ=}Ljȩ̭ʈ` !ƝLȱƝMȱƝN%BL_" r" H r"h`Lb" "ƈL"HpƝDȱƝEhBL_"#$>} ީ!&$ȩ&$`&$' 2$2ƅȱƅL180H1h`eHȱeǪh`ƅɈƅȱȥȦ qLF60``?}DZ ` !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)%@0```/ 6/B`,1` 6/B` ' BL_" 'B V()`E}` !ƝIƝHƝEƝD` " ``` ƪТ`ƪƨ0 =Т` ƪ Т`ƪF})ƨ0 = Т` &(` &(`ƪ- q`ƪȱƨ ݩ)@0)%ԅԢ ޢ ڰ9 @ݰ.G} ڰ" fڥԅԥ /' (L&ƅȱƅȄ`̽ɛ ,`̽ɛ ,` )hH}GhLb"̮֩(HIDEB V8``ʅ͍(ȩɱ !(ƅɈƅȄ (ʱ` i*% LbI}I" H (hD$̅ (ԑȥՑ (Lt)F$̅ (ԑΈ (Lt)S%̅ ( (̪ʊ8ĨȩΈJ}LjLt)CLt) (̽ (Lt) "̄ͱʅαͥ``ȱܱƅɈƅȢ`{a `K}LjA[i Ls* "Π i*Ȉȱ :& șȈ..Ȅ̤αʤ̑`@L}Zi`ƝDȱƝEBȱƆ i*ARWUD`   J V0^J`Lb"ƨx`ƨТ`M}Džȭ Ȑ Ң`Ɲ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}DZ. 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/LL,3)L26`XL3Ȍ5ƅՈƅԥ5H)BJi0:i 2h)i0:i 25 5L{36L1C ʱ^} 2L3SL+ʱƅȱƅŭ6 4L3656ΰ 2 4L4 46ΰ 2L3 2`ƍƍ_})Hƨh`ƠƠƠ /ȊLe 04 l` 048 "L"ƅVȱƅTƅU` 4 eLb" 4``}yBL_" 4 NLb" !ƅɈƅFi4Gi4 4者L4 `hhLb" ! BL_"0`8Hƪh`?P~a}ȱƪ.Ơƈƪ5ƠƠL,ƍ`ȱƪƝ6` !C`…ȱ…ňiȱiĠªȱ…Æ L6eȱeLx5…ȱb}L…ťiÈ8ȱ0L"iàL6eȱeťiL5RS[" 6" 69©6 O$66@c}@L6@"C6F6B"/ w@ 6`iàL6…ȱ…ťiÈԑL6…ȱ…ťiåd}ՑĈԑL6ȱňĥԑĥ8ê-6-6L.…ȱ…ťiÈąԄL6…ȱ…ťiñąՈąL6e}eȱeLj6ȱňĥԑĥȑĈL6ԅԄL6ԪȱԈՆL6i‘ȱ‘Lj6…ȱ…Lj6iԑȑL6Աf}NJȦձՊL6iȱª¨„ iiȑÈL6q…q…ȱÍ 88L6±ŠȦñg}ÊL6ªȱ…ƈL6 L*8Lj6 ȥL(Lq…q…Lj6&L6&ձeԅȱeՅՈL68ԅȱՅՈL6h}ǥԅՅȱ -ԥL6 8L8 8ԥL6ȱդL0-ԅȱՅՈL6EԅȱEՅՈL6%ԅȱ%ՅՈL6i}ȱJfՈL6ȱL6ȱ*ՈL6ԱL68ԅԩՅL6EԅԩEՅL6L6Lj}68Ԫȱ`ȱL6ȱԄL6 90 90 90ʊ 90ȱՐɱԐȱՐзk}nԐЭȱՐЎԐL9ȱՐ԰L9…ԄL6ԄL6i‘ȩL6L6}G; A simple floating point calculatorINCLUDE "D1:STDI .ACT"INCLUDE "D1:FLOAT.ACT"PROC main() FLOAT a(6),b(6),sum(6) Bm}mYTE C cprintf("A simple floating point calculator%n"); cprintf("}Enter a number, a space or RETURN,%n,an operator, a spacn}e or RETURN%n"); cprintf("and a second number.%nExample: 2 + 2 RETURN%n"); cprintf("Allowable operators are: +,-,/,*%n%n"o}X); cprintf("Press BREAK key to quit.%n%n"); while scanf("%f %c %f",a,@c,b) >= 0 DO \ wcprintf("%f %c %f ",a,c,b){ ifp}1 c= '+ then fadd(a,b,sum) cprintf("= %f%n",sum);5 lelseif c= '- then fsub(a,b,sum) cprintf("= %f%n",sum);p elseif c= '* q}*then fmul(a,b,sum) cprintf("= %f%n",sum);. eelseif c= '/ then fdiv(a,b,sum) cprintf("= %f%n",sum);i else cprintf("%c is r}an unkown operator.%n",c)  0fi OD RETURN}0MODULE ;ŮԠ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}}D=*(CARD voice,pitch,distortion, BYTE volume) asetup1() [JMP $30B7]PROC ZERO=*(CARD addr,size) asetup1() [JMP $3075]MODULE~}C}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* E.INCLUDE #D1:MACRO.M650140J e.INCLUDE #D1:STDIO.M650150j .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 }mTE 1,2,3,4,5,60280 C .BYTE 00290 ;0300 MAIN DISPLAY "}Floating point calculator with MAC/65.",EOL0310s DISPLAY " }XEnter: # [space] operator [space] #",EOL,EOL0320 MAINLP SCANF "%f %c %f",FA,C,FB0330] cCPX #0i ;bad input such as h }*itting the break key will exit to DOS0340/ BNE MULTIPLY?0460D aFSUB FA,FB,SUM ;SUM=A-B0470f JMP ENDSWITCH0480 MULT }IPLY? CMP #'*0490 'BNE DIVIDE?0500- JFMUL FA,FB,SUM ;SUM=A*B0510O vJMP ENDSWITCH0520 DIVIDE? CMP #'/0530{ BN } E UNKOWN0540 0FDIV FA,FB,SUM ;SUM=A/B05505 JMP ENDSWITCH0560 UNKOWN PRINTF "%c is an unkown operator.%n",C0570 } YJMP MAINLP0580 ENDSWITCH PRINTFS "= %f%n",SUM ;NOTE: %n is used instead of \n0590^ iJMP MAINLP} iY/* BATCH.C *//* creates a file containing a command line which is run as a .COM file */^ main() $( int iocb; char f}1ilename[20],buf[130]; if(!getdos(filename)) $(5 Pprintf("Enter filename:");T 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);2 printf("Old text:\n%s\n",buf+6); $) else printf("Text?\n"); if(gets(b}C\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(0x%F,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. */ A#define SPACE 32#define EOL 155F int iocb,count,i,csflag,dflag,iocb2,len,size,pad;char}= s[20],c,lastchar,nextchar,*bufptr,*endptr,bak[20],*address;B 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)) $(} 8backup=1; /* default is to create a backup file */< Hcloseall();L aif(isdigit(s[3])) $(g vpad=atoi(s+3);| c} ontinue; $) Wif((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);B Tnormalize(s,"C");X fif(backup) $(l normalize(bak,"BA}K"); (printf("%s <<< %s\n",s,bak);, /$)3 Xelse printf("%s (no back-up)\n",s);\ yif((iocb=fopen(s,"r"))<1) $(} } printf("Can't open %s\n",s);% /continue;3 6$): vlen=bgets(address,size,iocb); /* read in all of the text */z clo} se(iocb); if(backup) $(" 8iocb2=fopen(bak,"w");> bputs(address,len,iocb2); /* write all of the text to a backup }*/ close(iocb2); $)" Wendptr=address+len; /* get the length of the text */[ *(endptr+1)=EOL; /* to avoid some }checks for end of buffer */ 3iocb=fopen(s,"w");7 Gbufptr=address;K while(isspace(*bufptr)) ++bufptr; /* remove any st}arting spaces */ Efor(;bufptr':E Ocase '<':W case '!': /* space around !=,>=,<= */} $if(*(bufptr+1) == '=') $(0 Uif(*(bufptr-1) != SPACE) out(SPACE);a iout(c);u ++bufptr}; out('=');$ Iif(*(bufptr+1) != SPACE) out(SPACE);S V$)` melse out(c);w break;} 7case '0': /* convert all hex to upper case */A Iout(c);S if((c=tolower(*(bufptr+1))) == 'x') $( } out(c); (bufptr+=2;4 awhile(hex(*bufptr)) out(toupper(*bufptr++));m w--bufptr;} } $) break; Fcase '/': /* this handles comments */P jif(*(bufptr+1) == '*') $(v while(*}Cbufptr != EOL) out(*bufptr++);+ 5--bufptr;? B$)L Yelse out(c);c jbreak;r case 13: /*} control M */ ?case EOL: /* this handles all returns */I Sout(EOL);] vif((bufptr+2)$)J i=0; /* adjust the padding according to 'case', 'de}fault', etc. */ if((*bufptr == '$') && (*(bufptr+1) == ')')) i=pad;/* don't add spaces for #ifs, labels, or comm}ents */ Tif(*bufptr == '/' || *bufptr == '#' || *bufptr == ':') i=count;` if(smatch(bufptr,"asm ")) i-=}pad; /* indent */ lfor(;i='0' && c<='9') || (tolower(c)>='a' && to}1lower(c)<='f')) return 1; else return 0;$) }1G/* 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) != 0xF!) $(% Eprintf("Not a binary file!\n");I exit(); $) buf+=2; /* get past the header */ p}lace=buf; while(1) $( Rif((begin=getint(place))<0) break; /* end of file? */V end=getint(place+2); /* end of first mo}Edule */ +printf("\n%x - %x",begin,end);/ Htmp=(end-begin)+5+place;L wif(tmp >= endbuf) break; /* end of file */{ if}(getint(tmp) == 0xF) $(! >printf(" *HEADER REMOVED*");D `move(tmp+2,tmp,endbuf-tmp);f qendbuf-=2;u x$)| i}.f(getint(tmp) == (end+1)) $( /* compact it */4 Kprintf(" Compacted");Q g*(place+2)= *(tmp+2);m *(place+3)= *(tm}p+3); (move(tmp+4,tmp,endbuf-tmp);. 9endbuf-=4;= @$)D 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 */}3 return dpeek(where);$)#include "D1:GETNAME.C"}3G/* CONFIG.C *//* Allows you to change density on a non-Atari drive */L r#define SIO 0xE459#define DCB 0x300w char })*single,*double,*request,*send,data[12];. main() $( int drive; init(); /* initialize various code blocks */ while(}1) $( 0header(); /* print command summary */4 Wswitch(toupper(drive=getkey())) $(] gcase '1':m wcase '2':} } read(drive-'0'); "break;( 2case 'W':: Cwrite();K Rbreak;X bcase 'Q':j rexit();z bre}ak; default: "break;& 4$) $)$) 9 Rheader() $( printf("\nY 1-2 = read configuration\n"); prin}tf(" 2W = write configuration\n"); printf("9 \Q = quit, exit to DOS\n\n");$) a 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");}G if((drive=getkey()-'0')<1 || (drive>2)) return; printf("S -single density\nD -double density\nA - abort\n"); density=to}&upper(getkey()); switch(density) $(* 4case 'S':: Pmove(single,data,12);V printf("Configure D%d: as single densit}y?\n",drive); Eif(toupper(getkey()) != 'Y') return badconfig();K Rbreak;V `case 'D':f move(double,data,12); } :printf("Configure D%d: as double density?\n",drive);@ qif(toupper(getkey()) != 'Y') return badconfig();w break;} default: return; m$) move(send,DCB,12); poke(DCB+1,drive); jsr SIO; read(drive);$) r badconfig(}5) $( printf("Configuration not written.\n");$) : read(drive)int drive;$( move(request,DCB,12); poke(DCB+1,}*drive); jsr SIO; if(peek(DCB+3)>1) $(. dprintf("ERROR #%D reading D%d:\n",peek(DCB+3),drive);h 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 }yrive[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? */b scommand=file[3];y if(! }6getdos(file)) exit(); /* if no filename, then exit */: =$)A Mcloseall();Q fnormalize(file," ");j switch(command) $( } case 'P': /* protect */& Hprintf("Protecting %s\n\n",file);P ]flock(file);e lbreak;r case 'U': / }* unprotect */ ;printf("Unprotecting %s\n\n",file);C Rfunlock(file);Z abreak;g case 'E': /* erase */ } 'printf("%s is erased\n",file);/ =ferase(file);E Lbreak;R icase 'R': /* rename */q if(getdos(ne }w)) $( ptr=new;$ >while(*ptr != ':') ++ptr;H R*ptr=' ';\ printf("Renaming %s as%s\n",file, }ptr); "strcat(file,ptr);, ;frename(file);C F$)N Ubreak;[ ecase 'C':m ycopy(file);~ }C break; @case '-': /* chain everything following a - */H \strcpy(0x680,file);d *(index(0x680,"."))=0; } while(getdos(file)) $(' :strcat(0x680," ");D Xstrcat(0x680,file);` c$)k ychain(0x680);~ } break; default :# Sprintf("%c is an unkown command!\n\n",command);[ cexit();k rbreak;v $) $) }Ǜ 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? */& Jif((iocb=copen(fname,'d')) <= 0) $(P printf("Can't open directory of %s\n",fname); } exit(); $) #count=0;' _while(cgets(tmp,iocb)>0) $( /* read in the filenames */e strcpy(tmp,tmp+2); /* re }move lock/unlock code */ $i=0;* fwhile((ext[i]=tmp[8+i])>SPACE) ++i; /* get the extension */l ext[i]=tmp[8]=0; } ^if((i=find(tmp,8,SPACE))>0) tmp[i]=0; /* end the primary with the first space if any */d normalize(tmp,ext); /* ad }d the extension */ Itmp[1]=drive[3]; /* add correct drive number */O strcpy(names+count,tmp); /* put it in our tabl }e */ count+=16; $)! Rcount-=16; $) else $( /* single file only */V kstrcpy(names,fname);o count=1; $) } if(!count) $( 5printf("Can't find %s\n",fname);9 return; $) for(i=0;i",fname);c if((iocbin=fopen(fname,"r" } ))>0) $( Efname[1]=drive[4]; /* change the "to" drive number */K oif((iocbout=fopen(fname,"w"))>0) $(w printf }("%s\n",fname); do $(( Flen=bgets(buf,maxlen,iocbin);P hbputs(buf,len,iocbout);p s$){ wh }Dile(len == maxlen); /* keep trying till the whole file is copied */J M$)S else if(iocbout == -167) printf(" ***file }locked***\n"); ?else printf(" error #%d\n",abs(iocbout));C F$)J else printf(" error #%d\n",abs(iocbin)); $) clo }Cseall();$) } "/* 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%}Co start.\n"); getkey(); init(); /* initialize */ while(1) $(G cif((r=peek(764)) < 0xFF) $(i if(r == 6) up(); %} else if(r == 7) down();! :else if(r == 14) left();@ Zelse if(r == 15) right();` else if(r == 28) init(); /* e%}scape key, erase screen */! )else $(1 =r=getkey();E ]if(r == 'S') setsize();e if(r == 'E') erase(); %} 4if(r == 'C') $( /* change the color by one */> Vshade=(++shade) & 0x0F;` lfixcolor();t w$)} %}$) poke(764,0xFF); $)$ 3l=locate(x,y);7 ^l1=(++l1) & 3; /* cycle through 0-3 */b mcolor(l1);q 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;V ipoke(0x155D,ival);q xbreak;} )'} case 3: Mpoke(0x155E,peek(0x155E) ^ 0xFF);/* flip whatever it was */U npoke(0x41,peek(0x155E));v break; )(}  case 4: 0) $(y ++fc-7}!ount; /* count the files read */% cprintf(out,"%s",linebuf); /* print the name, but no return */g if(out) printf(out," -8}0 "); /* send spaces if it's to the printer */4 epoke(0x55,20); /* move the cursor to column 2 */i if(fgets(linebuf,ioc-9} b)>0) $( 4++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 '+':7 Ffadd(a,b,sum);N Ubreak;[ ecase '-':m fsub(a,b,sum); 1A} break; case '*':& 5fmul(a,b,sum);= Dbreak;J Tcase '/':\ kfdiv(a,b,sum);s break; 1B} default: =printf("%c is an unkown operator.\n",c);E Ocontinue;S V$)Z 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}v printf(""); count=0; clear(f1,8); /* clear f1 and f2 */ while((c1=fgetc(n1))>=0) $( /* until end of file */z if(5G}Cc1 != (c2=fgetc(n2))) $( 'slow();- printf(" %d\n%s != %s\n %d != %d\t",count,name1,name2,c15H}H,c2); .printf("'%c' != '%c'\n\n",c1,c2);4 Hfor(i=0;i<4;++i) $(P tif((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) $(5 Yif((count<4) && (i$%x< ",c2);$ `for(i=0;i<4;++i) if((t2=fgetc(n2)) >= 0) printf("$%x ",t2);f vprintf("\n\n");| i5L}f((t1 >= 0) && (t2 >= 0)) $(% Aprintf("Continue?(Y/N)\n");I nif(toupper(getkey()) != 'Y') exit();v else $(5M} count+=5; )f1[3]=t1;3 =f2[3]=t2;G Qcontinue;Y \$)b e$)k sexit();w $) 5N} ++count; move(f1+1,f1,3);# 4move(f2+1,f2,3);8 Bf1[3]=c1;F jf2[3]=c2; $) if(fgetc(n2)>0) $(n vslow();z 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}F call routine to change the string to inverse */ len=bgets(0x5000,0xJF,iocb); closeall(); k=len/1024; rem=((len%1029T}q4)*10)/1024; printf("\u\n%s\n%d.%dK %d sectors + %d bytes\n\n",name,k,rem,len/divisor,len%divisor);$) v get9U}4read(s,ext)char *s,*ext;$( int iocb; do $(8 Dgetname(s);H Znormalize(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 */ 5printf("Filename? ");9 Aslow();E Vif(gets(s)<1) $(\ kprintf("\u");q yexit();} 9X}`$) $)$) inverse(str) /* convert string to inverse */char *str;$( while(*str) $(d *str |= 128; /* or in the9Y}C inverse bit */ &++str; $)$) }8&Z/* 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}gngle line resolution *//* i=2 > double line resolution */pmgraphics(i)int i;$( int j; if(i) $(k poke(SDMCTL,i==1 ?=c} 0x3E : 0x2E); /* enable DMA */$ 4poke(GRACTL,3);8 Rplaysize= (i==1) ? 8 : 7;V lclear(playbase,2048);p 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);% 5poke(GRACTL,0);9 Mfor(j=0;j<4;++j) $(S epoke(HPOSPL+j,0);k 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}$_`ddBhDOS WSYSBlFCALC ACTB sRUNTIME ACTB FCALC ASMB BATCH C B1CB] C B COMPACT C BCONFIG C BCOPY C BCUBE 8C BCUSTOM C B-DIR= C B<FCALC C B DFILECMP C B QFSIZE C BZGRAPHICSC CBHEXDMP C BHVAL 9C BISORT C B$LIFE= IC BMENUM C BMGRDEMO C BPMDEMO C B QSORT C l9B SIEVE C B'SNAKE C B6SORTDIR C B UTYPE= XC B^WATFALL C BxDIR] iCOMB|LIFEm yCOMBLIFE} LNKC9BMGRDEMO LNKBPMDEMO LNKBMACRO M65BLIFE= @OBJq 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=}jrevious value when moving the shape by one */pmload() asm 0x310B; /* (n,x,y,shape) n is player number */}<j5/* HEXDMP.C *//* Display a file in hex and ascii */: Kint iocb,place;P main() $( int newplace,i,j,count,tmp; chA}ar name[20],hold[8],*addr; j closeall(); addr=lomem(10); iocb=getread(name," "); printf("\fhexo >>> %s <<<\n\nA}U",name); newplace=place=0; goto start; /* begin with place zero */ while(1) $(Y iposition(0,20);m poke(752,0); /* A} cursor on */ Dprintf("Enter place ('.' if decimal) -,+ okay\n");H tif((newplace=getnum()) == -1) break;:startx 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;? Lprintf("\fhexQ f>>> %s <<<\n",name);j for(i=0;i<16;++i) $A}( printf("%x- ",place);$ .place+=8;4 nfor(count=0;count<8;++count) $( /* output 8 hex digits */v if((tmpA}*=fgetc(iocb))<0) break; /* end of file */2 vif(tmp == 155) hold[count]='.'; /* don't send a return character */} A} else hold[count]=tmp; 2printf("%x ",tmp);8 ;$)A Sposition(32,i+1);Y poke(0x2FE,1); /* display control coA}des */ nfor(j=0;j= 'A') && (c <= 'F')) v=(v<<4)+(c-55);X else break; $) return v;$) A} #include "GETNAME.C"}@hhval(s) /* hex string to integer */char *s;$( int v; char c; v=0; while((c=toupper(*s++))) $(l if(isnumeric(c)) E}v=(v<<4)+(c & 0xF); Kelse if((c >= 'A') && (c <= 'F')) v=(v<<4)+(c-55);O oelse 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}F[NRECORDS]; int count,len,i; char *buf,*ptr,*endptr; FILE iocb;K 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) $(' Jprintf("Can't open %s\n",file_in);N 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) $(a printf("Cannot allocate enouI}7gh memory for %s\n",file_in); /* print msg and exit */; error("Not enough memory for",file_in); $) fclose(iocb); endI}iptr=buf+len; for(ptr=addr[0]=buf, count=1; ptr128) && ptr0) $( -a[j]=a[j-1];3 8--j;< ?$)C Ua[j]=v; $) $) }HU /* LIFE.C */ k#define MODE 21 /* graphics mode 5 */#define XMAX 79#define YMAX 47#define SIZE 5100p 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}pE); dpoke(0x80,tx); dpoke(0x82,&x); dpoke(0x84,&y); dpoke(0x86,&cell); while(1) $( /* place ncells */t clear(&c,M} &change-&c); poke(764,255);$ 8x=xmax=xmin=XMAX/2;< Py=ymax=ymin=YMAX/2;T dcount=change=0;h mz=3;q graphics(MODM} E-16); /* allows text window */$ 3position(0,0);7 Jwhile(!inkey()) $(P Wcol=0;] while((d=stick(0)) == 15 && peekM}(764) == 255) $( 'color(col++);/ :col=col&3;B Mplot(x,y);U if(change != z) $( /* print only if coloM}r is changed */ Aif(z == 0) printf(">>off<<\n",cls());K lelse printf(">>on<< \n",cls());v change=M}z; $) $) 'color(z);- 8plot(x,y);> Ntx[(x<<6)+y]=z;T `if(d<15) $(h if(z == 3) adjust(); M}#/* check for x and y boundaries */+ Bfor(t=0;t <= 300;t++);J Tplace(d);\ fcontinue;l o$)u c=getkeyM}C(); if(c == '<') $(" 'z=0;/ 9continue;? B$)H Xif(c == '>') $(` ez=3;m wcontinue;} M}$) if(c == ' ') break;# )d=15;/ Bif(c == '+') d=11;H Zif(c == '*') d=7;` sif(c == '-') d=14;y if(cM} == '=') d=13; 1if(c == 'D' || c == 'd') $(9 kprintf("Press arrow key to indicate direction.");s c=getkey()M}; if(c == '+') d=111;& 9if(c == '*') d=17;A Uif(c == '-') d=114;] qif(c == '=') d=113;w $) M}> printf("Press number, or '.' if greater than 9.\n",cls());D dif((n=getkey()) != '.') n-='0';j relse $(z priM}ntf("Number?"); $gets(numb);, :n=atoi(numb);@ C$)I Scolor(z);Y mfor(t=0;txmax) xmax=x; if(yymax) ymax=y;$) M life() $(/* change ncells */ poke(764,255);M}* graphics(MODE+32); while(!inkey()) $(. 5e=n=0;9 Dyt=ymax+2;H Sxt=xmax+2;W qfor(y=ymin-1;y4)) $(M} 9ex[e]=x; /* erase cell due to overcrowding */C Ney[e++]=y;V Y$)a yelse if(ncells == 3) $(} M} 3nx[n]=x; /* new cell or keep the old cell */= Hny[n++]=y;P S$)Y \$)` c$)g vif(n) ++count;z elsM}e $( 7graphics(MODE-16); /* allows text window */= _printf("%d generations\n",count);e printf("\nPress space toM} continue\n"); getkey();% -return;1 4$)8 Bcolor(0);F ffor(t=0;txmax) xmax=c;t if((c=ny[M}t])>ymax) ymax=c; 0else if(cYMAX-2) ymaxM}C =YMAX-2; 5if(xmax>XMAX-2) xmax=XMAX-2; $)$) : Nkount() asm 0x600;S place(data)int data;$( switch(dataM}) $( case 11: --x;# *break;. 6case 7:< A++x;G Nbreak;R [case 13:a f++y;l sbreak;w case 1M}4:; --y; break; *case 111:0 5--x;; @++y;F Mbreak;Q Zcase 17:` e++x;k p++y;v break;M} case 113: --y; $++x;* 1break;5 ?case 114:E J--y;P U--x;[ bbreak;f odefault:u break; M}R $) 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./ 2*/7 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} $( 8printf("Can't open directory of %s\n",dirname);< exit(); /* fatal error, so return to DOS */ $) count=0; whiQ}Ale(cgets(tmp,iocb) > 0) $( /* read all the matching filenames */E strcpy(filename+count,dirname); /* start with the drive Q}*/ @for(place=3,i=2;i<=10;++i) $( /* add the primary name */F if(isspace(tmp[i])) break; /* stop if it's a space */ Q} ,else filename[count+(place++)]=tmp[i];0 3$)7 hfilename[count+place]=0; /* end of the string */l 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 */  Lif(index(filename+count,":CC.COM")) continue;Q RV else count+=17; /* next filename */ $Q}K) count-=17; /* remove the FREE SECTORS */ closeall(); if(!count) $(O fprintf("NO FILES!\n");j exit(); /* Can't doQ} a menu with no files! */ $)$ A/* Now we print the menu */F 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 */# Xchain(filename+((i-'A')*17)); /* go run it! */$) }PXj/* MGRDEMO.C *//* Demonstrate MGR graphics */ int x,y,nx,ny,x2,y2,nx2,ny2,xmove,ymove,xc,yc,radius,i;o #define SIZE U}20 Emain() $( xc=80; yc=48; graphics(7+16); while(1) $(I \/* plot() demo */` jcolor(1);n for(y=0;y<96;y+U}#=2) for(x=0;x<160;x+=2) plot(x,y);' 2mcolor(3);6 ifor(y=0;y<96;y+=2) for(x=0;x<160;x+=2) mplot(x,y);m xmcolor(0);| fU}2or(y=0;y<96;y+=2) for(x=0;x<160;x+=2) mplot(x,y);6 K/* drawto() demo */O Ycolor(1);] sfor(x=0;x<160;++x) $(y plotU}(x,0); drawto(x,95); "$)& :for(i=0;i<3;++i) $(@ Kmcolor(3);Q gfor(x=0;x<160;++x) $(o mplot(x,0); U} mdrawto(x,95); $)$ /mcolor(0);5 Nfor(x=159;x >= 0;--x) $(V bmplot(x,0);j ymdrawto(x,95);} U} $) $) %/* circle() demo */) =for(i=0;i<2;++i) $(C Mcolor(1);S 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);a d$)h for(i=0;i<10;++i) $(U} mcolor(3); Pfor(radius=4;radius<48;radius+=4) mcircle(xc,yc,radius);V amcolor(0);g for(radius=4;radius<48U}#;radius+=4) mcircle(xc,yc,radius);' *$). @/* box() demo */D Yfor(x=0;x<10;++x) $(_ jmcolor(3);p for(i=4;i<96/U}#2;i+=4) mbox(80+i,48+i,80-i,48-i);) 4mcolor(0);: jfor(i=4;i<96/2;i+=4) mbox(80+i,48+i,80-i,48-i);n $)/* fill demoU} */ mcolor(1); $mplot(80,0);( 9mdrawto(159,95);= Lmdrawto(0,95);P _mdrawto(80,0);c mcolor(1);q plot(80,0);U} fill(1,94,1); $mcolor('\f');( 3mcolor(3);7 Dmplot(80,0);H Ymdrawto(159,95);] lmdrawto(0,95);p mdrawto(80,0)U}C; mvfill(80,94); $clrtime();( =while(gtime() < 60);A Lmcolor(2);P cmcircle(80,48,40);g vmvfill(80,48);z mcoU}lor(1); mplot(50,28); /mdrawto(110,28);3 Cmdrawto(90,48);G Xmdrawto(110,68);\ lmdrawto(50,68);p mdrawto(70,48U}); mdrawto(50,28); )mfill(80,48);- 8clrtime();< Pwhile(gtime() <60);T xmcolor('\f');/* filled box demo */| nU} x=160/2; ny=96/2; 'nx2=nx+SIZE;+ 8ny2=ny+SIZE;< Pxmove=-5; ymove=-5;T jfor(i=0;i<300;++i) $(p x=nx; y=ny; U} x2=nx2; y2=ny2; 1nx+=xmove; ny+=ymove;7 Qnx2=nx+SIZE; ny2=ny+SIZE;W kif(nx < 6) xmove=5;q else if(nx >U} 153-SIZE) xmove=-5; /if(ny < 6) ymove=5;5 Uelse if(ny > 89-SIZE) ymove=-5;[ fmcolor(0);l mfbox(x,y,x2,y2);U} mcolor(3); .mfbox(nx,ny,nx2,ny2);2 E$)/* face demo */I Tmcolor(2);X rmcircle(160/2,96/2,94/2);v mvfill(U} 160/2,96/2); mcolor(0); 5mcircle(60,96/3,10);9 Imfill(60,96/3);M cmcircle(100,96/3,10);g xmfill(100,96/3);| mU}fbox(60,60,100,70); -for(i=0;i<50;++i) $(3 >mcolor(1);D ifor(radius=2;radius<10;radius+=2) $(q mcircle(60,9U} 6/3,radius); /mcircle(100,96/3,radius);5 8$)> Imcolor(0);O tfor(radius=2;radius<10;radius+=2) $(| mU}circle(60,96/3,radius); :mcircle(100,96/3,radius);@ C$)G U$) $)$) Z fill(x,y,c)int x;char y,c;$( U}U poke(765,c); dpoke(85,x); poke(84,y); return ciov(6,18,-1,-1,-1,-1); $) Z 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}Go\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) $(D npmcolor(i,4*i,8); /* define the colors */r 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}S\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) $(W hx[n]=105+(11*n);l uy[n]=80;y whilZ }8e(!(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) $( Rpmload(n,x[n],y[n],shape[n]); /* move the shape */X x[n]+=dx[n]; /* add the directions */Z } y[n]+=dy[n]; )if(x[n]<41) $(1 :dx[n]=1;B Lcontinue;R U$)[ kif(x[n]>200) $(s dx[n]=-1;Z} continue; $)! 0if(y[n]<32) $(8 Ady[n]=1;I Scontinue;Y \$)b rif(y[n]>223) $(z dy[Z}n]=-1; continue; t$)/* if we were looking for who we collided with, we would use hitpl(who,hitwho) */z if(Z})hitpl(n,-1)) $( /* did it hit anyone? */1 Wdx[n]=rand(3)-1; /* new directions */_ while(!(dx[n]=rand(3)-1)); Z} while(!(dy[n]=rand(3)-1));( 5y[n]+=dy[n];= [pmload(n,x[n],y[n],shape[n]);c opmclear(n);w chget(Z}Crand(127)+1,shape[n]+2); /* new shape drawn from character base */K Whitclear();] `$)d r$) $)$) }XrR/* CSORT.C *//* sorts lines using quicksort routine - removes duplicate lines */W #define LINES 2000 /* maximum number ^} of lines */ ?int gap,i,j,dif,*lineptr[LINES];char *temp;D 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); ^}G while(sort(nlines)) --nlines; /* sort the lines */ printf("%d lines sorted\n",nlines); fclose(iocb); if((iocb=fopen(fn^}ame,"w"))<0) $( 5printf("can't open %s\n",fname);9 exit(); $) for(i=0;i 0;gap/=2) $(_ ufor(i=gap;i= 0;j-=gap) $(% Uif(!(dif=strcmp(lineptr[j],lineptr[j+gap]))) $(_ printf("'%s' is a duplicate\n"^},lineptr[j]); 1lineptr[j]=lineptr[n-1];; rreturn 1; /* indicate two records were the same */z $)^} if(dif<0) break;! Jtemp=lineptr[j]; /* swap the pointers */R mlineptr[j]=lineptr[j+gap];u lineptr[^} j+gap]=temp; $) P$) $) return 0; /* indicate sort is done */$) U readlns(iocb)int iocb;$( int len^}n,count; char *addr; addr=lomem(100); /* beginning of text space */ for(count=len=0;len >= 0;++count) $(r lineptr[cou^}!nt]=addr; /* save the pointer */% ;len=cgets(addr,iocb);? kaddr+=(len+2); $) return --count;$) p #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; cfor(i=0;i <= SIZE;++i) flags[i]=TRUE; /* could use setblock(flags,SIZE,1); */g for(i=0;i <= SIZE;++i)b$} $( if(flags[i]) $(" /prime=i+i+3;7 ifor(k=i+prime;k<=SIZE;k += prime) flags[k]=FALSE;q ++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(}Clhough as many boxes as\n"); printf("possible without touching the line\nor the border.\n\n\n"); printf("t Press butf)})?ton to start.\n"); while(strig(0)); sc=hs=0; while(1) $(C Qgraphics(11);U upoke(710,0); /* screen black */y zx=1f*}; zy=0; x=40; y=90;$ Ecolor(10); /* draw the border */I Tplot(0,0);X fdrawto(79,0);j drawto(79,191); f+} drawto(0,191); !drawto(0,0);% ,box();0 iwhile(1) $( /* while no collision with self or border */o z=locate(x,y);f,} Lif((z == 10) || (z == 5)) break; /* collision with self or border */R \color(5);b mplot(x,y);s if(z == 15f-}) $( /* hit a box */ %sc+=10;- Ibox(); /* draw a new box */O R$)X ds=stick(0);j if(s<15) $( /* joysf.}tick was moved */ 4if((s == 14) && (!zy)) $(> Dzx=0;N Uzy=-1;] `$)h if((s == 13) && (!zy)f/}) $( zx=0; %zy=1;- 0$)8 Rif((s == 11) && (!zx)) $(\ czx=-1;m szy=0;{ $)f0} "if((s == 7) && (!zx)) $(, 2zx=1;< Bzy=0;J M$)S V$)\ for(z=1;z<100;++z); /* slow down!f1} */ x+=zx; y+=zy;$ *++sc;0 if(zx != 0) for(z=1;z<170;++z); /* slow down horizontal which is faster than f2} vertical */ $) :graphics(0); /* end of the game */> Kpoke(710,0);O ^position(5,7);b printf("score= %d\thighest f3}= %d\n",sc,hs); %if(sc>hs) hs=sc;) /sc=0;3 ;printf("@ `Press button to play again\n");d 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}B(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}Isub[14],buf[130*24],sub[16],path[64],dir[4]; main() $( while(1) $(M Vtitle();Z vstrcpy(wildsub,"D1:*.");z strj8}cpy(sub,"D1:"); *strcpy(dir,"D1:*.*");. Dstrcpy(path,"MAIN>");H vprintf("堣Π");z whij9};le((drive=getkey()) < '1' || (drive != 155 && drive>'8'));? Xif(drive == 155) exit();\ lputchar(drive);p putchar('\n')j:}C; wildsub[1]=drive; *dir[1]=drive;. 1;) $( j=} 2if(buf[pos+10] != ' ' && buf[pos] < '0') $(< Kbuf[pos+13]=0;U mprintf("%s\n",buf+pos);w pos +=j>} 24; $) $) -fclose(iocb);3 ;flag=1;A printf("\nPress RETURN to use current directory\nEnter < to j?}move up one directory,\n");" Mprintf("or enter subdirectory name\n\n>");S if(gets(sub+3)) ciov(iocb,44,sub,0xFF,0,0)j@}!; /* change working directory */' 4else flag=0;8 ;$)? Lwhile(flag);P printf("\f1) Sort by filename\n2) Sort by extjA}ension\n\n>"); 7while((i=getkey()) < '1' || i>'2');; Rext= (i == '1') ? 0:1;V printf("\n\u%s\n",(i == '1')?"jB}":""); 8i=ciov(iocb,3,dir,0xFF,20,128);< Gif(i<1) $(M jprintf("Error %d\n",abs(i));p 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');' Mfor(i=pos=0; i relse if(*(a[i]) & 32) $( /* subdirectories first */z putjI} char('>'); &bputs(a[i]+6,8,0);. Rprintf("%s\n",buf);V Y$)] if(len < 0) exit(); /* end of finZ}le */ -printf("\n");1 ;getkey();? printf("\u"); $)$) getname(s)char *s;$( if(!gn[}5etdos(s)) $( /* nothing was returned from DOS */9 Oprintf("Filename? ");S [slow();_ pif(gets(s)<1) $(v printf(n\}"\u"); exit(); c$) $)$) getread(s,ext)char *s,*ext;$( FILE iocb; do $(g sgetname(s);w normaln]} ize(s,ext); rif((iocb=fopen(s,"r"))<1) printf("Can't open %s\n",s); $) while(iocb<1); return iocb;$) }lrC@/* WATFALL.C *//* converted from Basic program of same name */E int temp,wt,x1,y1,x2,y2,fall,cflag,y,x,col,t,i,rx,ry,str_}_.col;char *data; delay() $( while(1) $(2 Btemp=peek(705);F [poke(705,peek(706));_ tpoke(706,peek(707));x poke(r`}707,peek(708)); $poke(708,temp);( for(wt=1;wt <= 100;++wt); $)$) main() $( data="\7\106\13\96\30\100\40\112\4ra}7\145\7\179\15\155\27\164\35\173\60\181\66\174"; graphics(10); poke(704,154); poke(705,138); poke(706,136); poke(70rb}7,134); setcolor(0,8,4); setcolor(1,12,4); setcolor(2,2,4); setcolor(3,12,6); setcolor(4,3,8); color(7); plot(7rc}9,10); drawto(79,45); x1=78; y1=10; x2=66; y2=15; dofill(); x1=65; y1=y2; x2=61; y2=18; dofill(); x1=rd}60; y1=y2; x2=56; y2=25; dofill(); x1=x2; y1=y2; x2=65; y2=35; dofill(); x1=66; y1=y2; x2=78; y2=45re}; dofill(); color(6); plot(79,46); drawto(79,145); x1=56; y1=26; x2=x1; y2=117; dofill(); y1=y2; x2=68;rf}EfǛ y2=132; dofill(); x1=x2; y1=y2; y2=145; dofill(); color(7); plot(0,191); drawto(79,191); drawto(79,146);rg}Ǜ x1=0; y1=191; x2=x1; y2=91; dofill(); fall=58; cflag=x2;/* waterfall */ for(y=25,fall=58;y <= 34;++y,++fallrh}) $( $for(x=79;x >= fall;--x) $(* ;color(rndcol());A Lplot(x,y);P $) /* next x */ $) /* next y */ cflag=1;ri}" for(fall=0,x=58;x <= 66;++x) $(& ;plot(x,25+(fall++));? Zfor(y=30;y <= 120;y+=4) $(` qcolor(rndcol());w 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) $(" 3color(rndcol());9 Dplot(x,y);H m$) $) for(t=0;t <= 20;t+=2) $(q x=data[t]; rm} y=data[t+1]; color(8);" 9for(i=0;i <= 2;++i) $(? Uplot(x-i,y-40+(2*i));[ sdrawto(x-i,y-20-(2*i));w $) rn} for(i=-2;i <= -1;++i) $(! 7plot(x-i,y-40-(2*i));= Udrawto(x-i,y-20+(2*i));Y ]$) a kcolor(6);o plot(x,y); ro} drawto(x,y-21); color(5);# 0plot(x,y+1);4 Edrawto(x+7,y+4);I Xplot(x+8,y+3);\ mdrawto(x+8,y+5);q drawto(x+9,yrp}+6); drawto(x+9,y+3); 0drawto(x+10,y+3);4 Fdrawto(x+10,y+7);J Zplot(x+11,y+7);^ pdrawto(x+11,y+4);t drawto(x+rq} 12,y+5); drawto(x+12,y+7);# -color(8);1 Ifor(i=1;i <= 15;++i) $(O mwhile((rx=x+rand(7)-3) == x);s 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}Cafill(x,y)int x;char y;$( dpoke(85,x); poke(84,y); return ciov(6,18,-1,-1,-1,-1); $) }pax0@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{}Qan't open printerTry again (Y/N)?*Tried directory of %sGot an rrror #%d%sV b%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}Gk }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}7tion.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`}x`stdiolifelife.obj}|(-47CEmgr.objmgrdemostdiodvcload.obj}(pmdemographicsstdio}A dX;}Macro for use withnX;LIGHTSPEED DOSx EI=EK=ELX;X;LIGHTSPEED DOS.SYS EQUATESX; CRITICB CIOV䴊} SIOY EOLPUTEDITTPUTSCREENeGETKEYbGETSCREENNMESSAGEh ERRORkMNUMBERn}CLOSEALLwDOSENTRY"GETFILENAMEDOSENTRY,DEFAULTDRIVEDOSENTRY6POINTERDOSENTRY @FULLFIL}ENAMEDOSENTRY!JCOMNDBUFFERDOSENTRY?TX;^X;internal macroshX;r LSCREEN | 3  ;;LDA }ǚQ>  PUTEDIT GETX   $>  $>  GETADR  Q>4 &PD90 Q>5 :P}E9DNX;X READ b  l$>v GETX GETADR #I9Q>PB9 CIOX; WRIT}E   $> GETX  GETADR  #I9*Q> 4PB9> CIOHRX;\ GET f GETX pQ>z}PH9PI9Q>PB9 CIOX; PUT  GETX ?Q>PH9PI9Q> PB9C CIO$}.X;8 OPEN B GETX LGETADR VQ> `PJ9jQ>tPB9~ CIOX; SCREEN LSCREEN  } LSCREEN   LSCREEN   LSCREEN    LSCREEN (  }G2$ AϠ٠ӠΠA<FPX;Z ADD d  n# x H@ADDEND1 #  @ADDEND1  }Ǫ,Q O   P  Q  O  P P  Q  O " P ,6@JX;T}SUBTRACT ^  hQ r H@SUBEND1| " @SUBEND1"   ;Q S   P  Q } S  P P  Q  S  P &0:DX;N IADD X,bQ l O>4 v  P }  D@IADDEND1 #  @IADDEND1 Q  O>5  P P  Q  O>5   P } *X;4ISUBTRACT >;HQ R S>4 \  fP p  zE@ISUBTRACTEND " @ISUBTRACTEND} Q  S>5  P P  Q  S>5  P   X; TRANSFER $ Q . P 8 Q }B P L V X;` CLOSEALL j  wt ~ X; DISPLAY  x2  Q>4@TEXT $>5@TEXT MESSAGE !@OUT} @TEXT                (  2 & ADisplay has too many arguementsA<} F  P @OUTZ d Q>4 n $>5 x MESSAGE   X; GETKEY ZERO * GETKEY  X; DPOKE Q>4}  P  Q>5  P   X; DZERO " Q>, P 6 P @  J P T P ^ h  r P | P}     P  P     P  P     ) AϠӠŠΠӠA }  X; ZERO  Q>& P 0  : P D N  X P b l  v P     P    } ( AϠӠŠΠӠA   X; ERROR ERROR  X; DOEDIT  x2  Q>4@T}EXT $>5@TEXT*  q4 !@OUT> @TEXT =H @OUTR \ Q>4 f $>5 p  qz   X; SETUPEDIT Q>4  $}>5   t }vo B B B B B B B B B B`JfJfee損iej`}vFFE