GL 87ARCZ& GL 87CAT3Z% GL 87ETCZ$ GL 87INCLUDEZ# GL :7SRCZ" GL!!7 READMEZ! PHADE SOFTWARE presents SHAREWARE NOTICE : Update 01.01.1990 -------------------------------------------------------------------- This program is Shareware. You may distribute it freely, but to use legally after a 10 - day - evaluation period you have to send 75 DM (or 40$) to : PHADE SOFTWARE Inhaber Frank Gadegast Schierker Strasse 39 1000 Berlin 44 Telefon : GERMANY (030) 6265667 In return, you will receive the latest version of this program, the source code and a registration number allowing you to use and change this program in every way you want. You will also receive the next update free. Your honesty will enable PHADE SOFTWARE to continue distributing quality Shareware products. Please include a brief description of your system when you register, and REPORT THE NAME OF THIS PROGRAM WITH THE VERSION NUMBER. All comments and ideas you like to add are welcome. If you have a good program that you like to add, send it. You will get the registration free. All following products are Shareware. If you like to have a copy contact PHADE SOFTWARE. PHADE SOFTWARE NEWS presents latest APPLE ][e PRODOS Utilities : -------------------------------------------------------------------- Aztec.Man : Aztec C65 Manual Aztec.Uti : Aztec C65 Utilities like FIND, FORMAT, HC, etc. Chess.Board : Chess for two players Hires.Tricks : Hires packing programs Starter : Full-screen startup program by directory entries Startup : Full-screen startup program with editor Text.Tricks : 40- & 80-column screen editors, scrolls, etc. PHADE SOFTWARE NEWS presents latest APPLE ][e DOS Utilities : -------------------------------------------------------------------- Chess Board : Chess for two players Dos & Tricks : Dos 3.3/4 utilities like BYE, CAT, BREAK BEEP Desk - Merger : Window graphic merging program DHGR - Utilities : Double-Hires expand utilities Hires - Pack : Hires packing programs Pager 2.2 : Full-window-screen text-editor Phade Shell : Unix-like Shell for Dos 3.3/4 or Z-Dos Phade Selector : Program selector with BYE-Command Startup : Full-screen startup program with editor Text & Tricks : 40- & 80-column screen editors, scrolls, etc. PHADE SOFTWARE NEWS presents latest APPLE ][e UCSD Utilities : -------------------------------------------------------------------- Filer ][ : Graphic - Window File-Utility and starting program ( secial appendix to SYSTEM.FILER ) Paint ][ : Graphic - Window Drawing-Program Startup ][ : Graphic - Window Startup-Program with editor Startup : Full-screen startup program with editor PHADE SOFTWARE presents latest IBM MS-DOS Utilities : -------------------------------------------------------------------- MENU : Full-textscreen Harddisk - Organization - Program You can install all your programs in a Window-Menu. Comes together with MENU-EDITOR and DIRECTORY STARTER. PI : Full-textscreen Organization - Program like NORTON INTEGRATOR You can install all your programs in a menu. Usefull to organize programs and there options. Editor included. UTIL : Usefull utilities like : CALC : Calculator CHAR : Shows charset DUMP : Dumps every file in different options MAP : Memory map (shows resident programs) MERGE : Merge textfiles PASS : Saves and rebuilds textfiles with password REMM : Removes remarks and krunchs textfiles GL!!7+ ARC/ERR.ARCZ make cc -Z5000 errm.c cc -Z5000 err.c ln err.o errm.o -lc errm.c /***************************************/ /* */ /* Error protocol */ /* */ /* by Phade Software */ /* Copyright (c) 1990 */ /* */ /* errm.c of err.c */ /* */ /***************************************/ #include #define IN (char)15 #define NO (char)14 char *comment[] = { "-> must be '0[0..7]'", "-> use cc -Z option", "-> double quote missing", "-> gulp", "-> not allowed to return aggregates", "-> type or non-declaration", "-> missing comma or semicolon", "-> be careful !", "-> see error 10", "-> zero specifications become positive integer",/*10*/ "-> too many levels", "-> pointer must be of type int or unsigned", "-> gulp", "-> gulp", "-> illegal combination of storage specifiers", "-> illegal combination of type specifiers", "-> enum etc not implemented", "-> error in use of long or unsigned type", "-> you got a old compiler version!", "-> check for multiply definition",/*20*/ "-> missing brace in structure", "-> { missing", "-> check type off called function", "-> functioncall without parentheses ?", "-> invalid symbol name", "-> symbol undeclared, type ?", "-> be careful !", "-> C permits the assignment of one structure to another", "-> check same call with dot and ampersand operator", "",/*30*/ "-> check function name, maybe internal ! missing operator ?", "-> be careful !", "-> don't connect - or ~ with structures, pointers, arrays or functions", "-> possible type or declaration omitted", "-> check casts and expressions", "-> use cc -E option", "", "-> must be static or external aggregate", "", "-> gulp",/*40*/ "-> remember statics and globals occurs at link-time not at run-time", "-> maybe byte array to small", "-> compiler is unable to interpret a word, check syntax", "-> the final brace is missing, check program structure", "-> cant interpret word in external declaration", "-> possible missing brace above", "-> check include directory and system variable", "-> legal name must begin with an alphabetic", "-> indentifier declared twice, use longer names to prevent this", "-> there is need of parenthesis, brckets or braces",/*50*/ "", "", "", "", "", "", "-> use backslash-newline sequence", "", "", "",/*60*/ "", "", "", "", "", "", "-> no corresponding if", "-> keyword not allowed here", "-> check preceding statements", "",/*70*/ "-> while missing", "", "", "", "", "", "", "", "", "",/*80*/ "", "", "", "", "", "", "", "", "", "",/*90*/ "", "", "", "", "", "", "", "", "", "",/*100*/ "", "", "", "", "", "", "", "", "", "",/*110*/ "", "", "", "", "", "", "", "", "", "",/*120*/ "", "", "", "", "", }; more() { printf ("%c FATAL COMPILER-ERRORS : %c\n", IN, NO); printf ("\n"); printf ("Out of disk space! -> Outputfile maybe writeprotected\n"); printf ("unknown option: -> Remember upper and lower case options\n"); printf ("duplicate output file -> -o don't overwrite -O specify new file\n"); printf ("too few arguments -> Must occur last in the command line\n"); printf ("Open failure on input -> File does not exist or cannot be opened\n"); printf ("No input! -> File was found is empty\n"); printf ("Open failure on output -> Maybe disk or directory full\n"); printf ("Local table full -> Use -L option to increment table\n"); printf ("Out of memory! -> Decrement -E -L -Y -Z table options\n"); printf ("\n"); printf ("%c MACHINE - INDEPENDENT COMPILEROPTIONS : %c\n", IN, NO); printf ("\n"); printf ("-A -> Don't start the assemler when compilation is done\n"); printf ("-D[symbol] -> Define a symbol to the preprocessor\n"); printf ("-l[dir] -> Search [directory] for #include files\n"); printf ("-O [file] -> Send output to [file]\n"); printf ("-S -> Silent option don't print warnings\n"); printf ("-T -> Include C source statements in the assembly code\n"); printf ("-B -> Don't pause after every fifth error to ask\n"); printf ("-E[num] -> Use an expression table having [num] entries\n"); printf ("-L[num] -> Use a local symbol table having [num] entries\n"); printf ("-Y[num] -> Use a case table having [num] entries in switch\n"); printf ("-Z[num] -> Use a literal table having [num] entries\n"); printf ("+C -> Generate 65C02 code (cc only)\n"); printf ("+B -> Don't generate the statement 'public.begin'\n"); printf ("+L -> Turn automatic variables into statics (cc only)\n"); printf ("\n"); printf ("%c LINKEROPTIONS : %c\n", IN, NO); printf ("\n"); printf ("-O [file] -> Write code to the file named [file]\n"); printf ("-L[name] -> Connect code with [name].lib modules\n"); printf ("-F [file] -> Read command arguments from [file]\n"); printf ("-T -> Generate a symbol table file\n"); printf ("-M -> Don't issue warning messages\n"); printf ("-N -> Don't abort if there are undefined symbols\n"); printf ("-V -> Be verbose\n"); printf ("-B [addr] -> Set base address to hex value [addr]\n"); printf ("-C [addr] -> Set code segment address to hex [addr]\n"); printf ("-D [addr] -> Set data segment address to hex [addr]\n"); printf ("-U [addr] -> Set uninitialized data segment to hex [addr]\n"); printf ("+B / +S -> Create [B]in- or [S]ys-program (link with samain.o)\n"); printf ("+H [s,e] -> Create a hole in program from hex [s]tart to [end]\n"); printf ("\n"); } comm(err) int err; { printf (" %s\n", comment[err]); } err.c /***************************************/ /* */ /* Error protocol */ /* */ /* by Phade Software */ /* Copyright (c) 1990 */ /* */ /* err.c of err.c */ /* */ /***************************************/ #include char *errstr[] = { " 1: bad digit in octal constant", " 2: string space exhausted", " 3: unterminated string", " 4: internal error", " 5: illegal type for function", " 6: error in argument declaration", " 7: bad declaration syntax", " 8: syntax error in type cast", " 9: array dimension must be constant of type char, int or unsigned", " 10: array size must be positive integer greater zero", " 11: data type too complex", " 12: illegal pointer reference", " 13: internal error", " 14: internal error", " 15: storage class conflict", " 16: data type conflict", " 17: unsupported data type", " 18: data type conflict", " 19: obsolete", " 20: structure redeclaration", " 21: missing } in aggregate initialization", " 22: syntax error in structure declaration", " 23: obsolete", " 24: missing right paranthesis or comma in function call", " 25: structure member name expected here", " 26: must be structure / union member", " 27: illegal type cast", " 28: incompatible structures used in assignment", " 29: illegal use of structure with operator or struct used as argument", " 30: missing : in ? conditional expression", " 31: call of non-function", " 32: illegal pointer calculation", " 33: illegal application of operator to type", " 34: undefined symbol", " 35: typedef not allowed here", " 36: no more expression space", " 37: invalid expression in expression containing unary operator", " 38: no auto aggregate initalization", " 39: obsolete", " 40: internal error", " 41: initializer must be a constant", " 42: too many initializers for aggregate", " 43: attempted initialization of undefined structure", " 44: obsolete", " 45: bad declaration syntax", " 46: missing closing brace", " 47: open failure on #include file", " 48: illegal symbol name in preprocessor statement", " 49: multiply defined symbol", " 50: missing paranthesis, bracket or brace", " 51: lvalue required on left side of assignment", " 52: obsolete", " 53: multiply defined goto label", " 54: too many goto labels", " 55: missing quote in #define", " 56: missing apostrophe in #define", " 57: line too long", " 58: illegal # encountered", " 59: macro too long", " 60: obsolete", " 61: reference of member of undefined structure", " 62: function body must compound statement / error in function declaration", " 63: no label for goto found in function", " 64: inappropriate arguments in function declaration", " 65: illegal or missing argument name in function argument list", " 66: expected comma in argument list", " 67: invalid else", " 68: syntax error", " 69: missing semicolon", " 70: bad goto syntax", " 71: statement syntax error in do-while", " 72: 'for' syntax error - missing first semicolon", " 73: 'for' syntax error - missing second semicolon", " 74: case value must be int, char or unsigned constant", " 75: missing colon on case", " 76: too many cases on switch", " 77: case outside of switch", " 78: missing colon in switch", " 79: duplicate default:", " 80: default: outside of switch", " 81: break / continue error", " 82: illegal character", " 83: too many nested includes", " 84: too many array dimensions", " 85: not an argument", " 86: null dimension in array", " 87: invalid character constant", " 88: not a structure", " 89: invalid storage class", " 90: symbol redeclared", " 91: illegal use of floating point type", " 92: illegal type conversion", " 93: illegal expression type for switch", " 94: bad argument to define", " 95: no argument list", " 96: missing argument to macro", " 97: obsolete", " 98: not enough args in macro reference", " 99: internal error", "100: internal error", "101: missing close paranthesis on macro reference", "102: macro arguments too long", "103: #else with no #if", "104: #endif with no #if", "105: #endasm with no #asm", "106: #asm within #asm block", "107: missing #endif", "108: missing #endasm", "109: #if value must be integer constant", "110: invalid use of colon operator", "111: illegal use of void expression", "112: illegal use of function pointer", "113: duplicate case in switch", "114: macro redefined", "115: keyword redefined", "116: field width must > 0", "117: invalid 0 length field", "118: field is too wide", "119: field not allowed here", "120: invalid type for field", "121: pointer / integer conversion", "122: pointer and integer not same size", "123: function pointer and pointer not the same size", "124: invalid pointer / pointer assignment", "125: too many subscripts or indirection on integer" }; main(argc,argv) int argc; char *argv[]; { int i; int zero = 0; int number = 0; int errnum; if (argc < 2) { printf ("\nusage : err 'cc error number[s] or 0'\n\n"); exit (-1); } printf ("\n%c ERROR PROTOCOL %c\n\n", (char)15, (char)14); for (i=1; i < argc; i++) { errnum = atoi (argv[i]); if (errnum < 0 || errnum > 125) printf ("\nusage : error number must be 1..125\n\n"); else { if (errnum == 0) zero = 1; else { number = 1; printf ("%s\n", errstr[errnum-1]); comm (errnum-1); } } } if (number) printf ("\n"); if (zero) more (); exit (0); }  GL!!7 ARC/ELIB.ARCZ makeelib clear echo Building E.LIB ... echo cc keypress.c cc killbuf.c cc oapple.c cc capple.c cc joyx.c cc joyy.c lb e.lib -v keypress killbuf oapple capple joyx joyy lock e.lib clear lb e.lib -t echo echo E.LIB is created. echo makeelibarc makeelib makeelibarc keypress.c killbuf.c oapple.c capple.c joyx.c joyy.c keypress.c /****************************************************/ /* */ /* KEYPRESS Copyright (C) 1990 by Phade Software */ /* */ /****************************************************/ int keypress () { #asm ROa EQU $08 ldy #$0 sty ROa+1 lda $C000 clc cmp #$80 bcs keytrue ldy #$0 jmp keyend keytrue ldy #$1 keyend sty ROa #endasm; } killbuf.c /***************************************************/ /* */ /* KILLBUF Copyright (C) 1990 by Phade Software */ /* */ /***************************************************/ killbuf () { #asm lda #$0 sta $C010 #endasm; } oapple.c /**************************************************/ /* */ /* OAPPLE Copyright (C) 1990 by Phade Software */ /* */ /**************************************************/ int oapple () { #asm ROc EQU $08 lda $C061 clc cmp #$80 bcs opentrue ldy #$0 sty ROc jmp openend opentrue ldy #$1 sty ROc openend ldy #$0 sty ROc+1 #endasm; } capple.c /**************************************************/ /* */ /* CAPPEL Copyright (C) 1990 by Phade Software */ /* */ /**************************************************/ int capple () { #asm ROb EQU $08 lda $C062 clc cmp #$80 bcs closetrue ldy #$0 sty ROb jmp closeend closetrue ldy #$1 sty ROb closeend ldy #$0 sty ROb+1 #endasm; } joyx.c /************************************************/ /* */ /* JOYX Copyright (C) 1990 by Phade Software */ /* */ /************************************************/ int joyx () { #asm ROd EQU $08 ldx #$00 jsr $FB1E sty ROd ldy #$00 sty ROd+1 #endasm; } joyy.c /************************************************/ /* */ /* JOYY Copyright (C) 1990 by Phade Software */ /* */ /************************************************/ int joyy () { #asm ROe EQU $08 ldx #$01 jsr $FB1E sty ROe ldy #$00 sty ROe+1 #endasm; }  GL!!7+& ARC/PHLIB.ARCZ makephlib clear echo Building PH.LIB ... echo cc chilp.c cc chrpos.c cc click.c cc getchar.c cc getdir.c cc peek.c cc poke.c cc qprintf.c cc scr.c cc strtok.c cc strtolow.c cc strtoup.c cc waitkey.c clear lb ph.lib -v chilp chrpos click getchar getdir peek poke qprintf scr strtok strtolow strtoup waitkey lock ph.lib clear lb ph.lib -t echo echo PH.LIB is created. echo makephlibarc makephlib makephlibarc chilp.c chrpos.c click.c getchar.c getdir.c peek.c poke.c qprintf.c scr.c strtok.c strtolow.c strtoup.c waitkey.c chilp.c /*************************************************/ /* */ /* CHILP Copyright (C) 1990 by Phade Software */ /* */ /*************************************************/ chilp() { #asm instxt _duett_ ldx #$50 stx R0 ldy #$69 j3 tya tax j1 dex bne j1 bit $c030 eor R0 tax j2 dex bne j2 bit $c030 dey bne j3 rts #endasm; } chrpos.c /**************************************************/ /* */ /* CHRPOS Copyright (C) 1990 by Phade Software */ /* */ /**************************************************/ int chrpos (str,ch) char *str; char ch; { int i; for (i=0; i 127) { flags[0] = 1; f = f - 128; } else flags[0] = 0; if (f > 63) { flags[1] = 1; f = f - 64; } else flags[1] = 0; if (f > 31) { flags[2] = 1; f = f - 32; } else flags[2] = 0; if (f > 15) f = f - 16; if (f > 7) f = f - 8; if (f > 3) f = f - 4; if (f > 1) { flags[3] = 1; f = f - 2; } else flags[3] = 0; if (f > 0) flags[4] = 1; else flags[4] = 0; } struct dir_file *set_file (count, fd) int count; int fd; { char *malloc (); struct dir_buf *buf = (struct dir_buf *)malloc (sizeof (struct dir_buf)); struct dir_file *entry=(struct dir_file *)malloc(sizeof(struct dir_file)); char header[5]; int nbytes; entry->next = (void *)0; while (1) { nbytes = read (fd, buf, 39); if (nbytes < 39) { close (fd); free (buf); free (header); return (entry); } if (++count == 13) { read (fd, header, 5); count = 0; } while (buf->length > 15) buf->length = buf->length - 16; if (buf->type == 0) { close (fd); free (buf); free (header); return (entry); } if (buf->length != 0) { entry->type = buf->type; entry->name = malloc (buf->length); strncpy (entry->name, buf->name, buf->length); *(entry->name+buf->length) = '\0'; entry->size = (long)buf->h_size * (long)256 + (long)buf->l_size; entry->loadadr = (long)buf->h_adr * (long)256 + (long)buf->l_adr; get_flags (entry->flags, buf->flags); free (buf); free (header); entry->next = set_file (count, fd); } } } struct dir_file *get_dir (path) char *path; { struct dir_info *di = (struct dir_info *)malloc (sizeof (struct dir_info)); struct dir_file *entry=(struct dir_file *)malloc(sizeof(struct dir_file)); char header[43]; int fd; int nbytes; if (getfinfo (path, di) == -1) { free (di); free (header); entry->next = (void *)0; return (entry); } if (di->file_type != 15) { free (di); free (header); entry->next = (void *)0; return (entry); } free (di); if ((fd = open (path, 0, 0)) < 0) { free (header); entry->next = (void *)0; return (entry); } nbytes = read (fd, header, 43); if (nbytes < 43) { close (fd); free (header); entry->next = (void *)0; return (entry); } free (header); return (set_file (1, fd)); } peek.c /************************************************/ /* */ /* PEEK Copyright (C) 1990 by Phade Software */ /* */ /************************************************/ int peek (adr) long adr; { #asm SPP EQU $02 ROP EQU $08 ldy #$0b lda (SPP),y tax iny lda (SPP),y stx $02 sta $03 ldy #$00 lda (SPP),y sta ROP sty ROP+1 #endasm; } poke.c /************************************************/ /* */ /* POKE Copyright (C) 1990 by Phade Software */ /* */ /************************************************/ poke (value, adr) int value; long adr; { #asm SPO EQU $02 ROO EQU $08 ldy #$0d lda (SPO),y sta ROO iny lda (SPO),y sta ROO+1 ldy #$0b lda (SPO),y jsr $fdda ldy #$00 sta (ROO),y #endasm; } qprintf.c /***************************************************/ /* */ /* QPRINTF Copyright (C) 1990 by Phade Software */ /* */ /***************************************************/ qprintf (ch) char *ch; { #asm RO EQU $02 RE EQU $08 ldy #$b lda (RO),Y sta RE iny lda (RO),Y sta RE+1 ldy #$0 qpl lda (RE),Y cmp #$0 beq qpe clc cmp #$9 beq qta clc adc #$80 jmp qpn qta lda #$a0 jsr $fded jsr $fded jsr $fded qpn jsr $fded iny jmp qpl qpe nop #endasm; } scr.c /*********************************************************/ /* */ /* SCR_FUNCTIONS Copyright (C) 1990 by Phade Software */ /* */ /*********************************************************/ scr_inverse () { printf ("%c", (char)15); } scr_normal () { printf ("%c", (char)14); } scr_scrolldown () { printf ("%c", (char)22); } scr_scrollup () { printf ("%c", (char)23); } strtok.c /**************************************************/ /* */ /* STRTOK Copyright (C) 1990 by Phade Software */ /* */ /**************************************************/ char *strtok (str,ch) char *str; char ch; { char *malloc (); static char *copy_str; char *ret; if (str != (void *)0) { free (copy_str); copy_str = malloc (strlen (str)); strcpy (copy_str, str); } ret = copy_str; while (*copy_str != '\0') { if (*copy_str == ch) { *copy_str = '\0'; copy_str++; return (ret); } copy_str++; } return ((void *)0); } strtolow.c /****************************************************/ /* */ /* STRTOLOW Copyright (C) 1990 by Phade Software */ /* */ /****************************************************/ strtolow (str) char *str; { int i; for (i=0; i #define SCR_TOP 0 #define SCR_BOT 23 #define STATUS 23 start_screen() { mv_curs(0, STATUS); printf ("%c LESS %c",(char)15,(char)14); mesg (""); if (*Fil_nam == 0 || read_fil(Fil_nam) < 0) quit(); redraw(Mem_buf, 1, SCR_TOP); } mesg(str) char *str; { mv_curs(10, STATUS); scr_eol(); mv_curs(10, STATUS); write(1, str, strlen(str)); } search(flg) int flg; { static char srch[80]; char buf[80]; register char *tp, *cp; register int c; cp = buf; *cp++ = '/'; for (;;) { *cp = 0; mesg(buf); if (flg) break; c = getchar(); if (c == '\r') break; if ((c == 8) || (c == 0x7f)) { if (cp > buf+1) cp--; continue; } if (c < 0x20) continue; *cp++ = c; } if (buf[1]) strcpy(srch, buf+1); if (srch[0] == 0) { mesg("no previous search string"); return; } *End_buf = 0; tp = Cur_ptr + 1; c = strlen(srch); for (;;) { cp = index(tp, srch[0]); if (cp == 0) { mesg("no match"); return; } if (strncmp(cp, srch, c) == 0) { Cur_lp = get_prev(get_next(Cur_ptr = cp)); if (Cur_lp >= Top_lp && Cur_lp < Bot_lp) { cp = Top_lp; Cur_lin = Top_lin; Cur_y = Top_y; while (cp < Cur_lp) { set_param(cp); Cur_y += Lin_siz; Cur_lin++; cp = get_next(cp); } } redraw(Cur_lp, Cur_lin, SCR_BOT/2); return; } tp = cp + 1; } } page(c) int c; { int wi; if ((c == 'd') || (c == 'u')) wi = 11; else wi = 23; if ((c == 'b') || (c == 'u')) { Num = Cur_lin - wi; if (Num <= 1) Num = 1; } else Num = Cur_lin + wi; Val = 1; goline(); } goline() { register char *t; if (Val == 0) Num = -1; Val = 0; Cur_lp = Mem_buf; Cur_lin = 1; while (--Num && (t = get_next(Cur_lp)) != End_buf) { Cur_lp = t; Cur_lin++; } Cur_ptr = Cur_lp; redraw(Cur_lp, Cur_lin, SCR_BOT/2); mesg(""); } get_num(c) int c; { char buf[10]; register char *cp; Num = 0; cp = buf; for (;;) { if (c < '0' || c > '9') { Val = Num; if (Num == 0) Num = 1; return(c); } Num = Num * 10 + c - '0'; *cp++ = c; *cp = 0; mesg(buf); c = getchar(); } } stats() { char buf[80]; register char *cp; register int c; maknam (buf, Fil_nam); cp = Mem_buf; c = 1; while ((cp = get_next(cp)) != End_buf) ++c; itoa (buf+strlen(buf), c); strcat (buf, " lines"); mesg (buf); } itoa(buf, num) char *buf; int num; { register int flg = 0; register int i, j = 1000; while (j) { i = num/j; num %= j; j /= 10; if (i == 0 && flg == 0) continue; *buf++ = i + '0'; flg = 1; } if (flg == 0) *buf++ = '0'; *buf = 0; } blockmv(dst,src,cnt) char *dst, *src; { movmem(src,dst,cnt); } #asm public db_ db_ lda #0 rts #endasm draw_lin(lp, d, y) char *lp; register int d; int y; { int c; register int i; mv_curs(d, y); for (;;) { c = *lp++; if (c < 0x20) { switch(c) { case '\t': i = Tabwidth; while (i <= d) i += Tabwidth; write(1, " ", i-d); d = i; break; case '\r': scr_eol(); return; default: write(1, "^", 1); c |= 0x40; write(1, &c, 1); d += 2; break; } } else { write(1, &c, 1); d++; } } } redraw(lp, lin, y) char *lp; int lin, y; { register char *cp; Top_lp = lp; Top_y = y; Top_lin = lin; for (;;) { if (Top_y == SCR_TOP || Top_lp == Mem_buf) break; cp = get_prev(Top_lp); set_param(cp); if (Top_y - Lin_siz < SCR_TOP) break; Top_y -= Lin_siz; Top_lin--; Top_lp = cp; } Top_y = SCR_TOP; draw(Top_lp, Top_lin, Top_y); } draw(lp, lin, y) char *lp; int lin; register int y; { Bot_lin = lin; Bot_lp = lp; for (;;) { if (y >= SCR_BOT) break; if (Bot_lp >= End_buf) draw_lin(" \r", 0, y++); else { set_param(Bot_lp); if (y + Lin_siz > SCR_BOT) draw_lin(" \r", 0, y++); else { draw_lin(Bot_lp, 0, y); if (Cur_lp == Bot_lp) { Cur_y = y; Cur_lin = Bot_lin; } Bot_y = y += Lin_siz; Bot_lp = get_next(Bot_lp); ++Bot_lin; } } } } set_param(lp) char *lp; { register int c, d; d = 0; for (;;) { if (Cur_ptr == lp) Cur_x = d; c = *lp++; if (c < 0x20) { switch(c) { case '\t': c = Tabwidth; while (c <= d) c += Tabwidth; d = c; break; case '\r': d++; Lin_siz = d / Lwidth + 1; return; default: d += 2; break; } } else { d++; } } } char *get_next(lp) register char *lp; { *End_buf = 0; lp = index(lp, '\r'); if (lp == 0) lp = End_buf; else ++lp; return(lp); } char *get_prev(lp) register char *lp; { lp--; while (*--lp != '\r' && lp >= Mem_buf); return(lp+1); } init() { struct sgttyb ss; char *malloc(); Max_mem = 35000; while ((Mem_buf = malloc(Max_mem)) == 0) Max_mem -= 2000; free(Mem_buf); Max_mem -= 1024; Mem_buf = malloc(Max_mem); Width = *(char *)0x21; Lwidth = Width + 1; scr_clear(); ioctl(1, TIOCGETP, &ss); ss.sg_flags = CBREAK; ioctl(1, TIOCSETP, &ss); } quit() { struct sgttyb ss; mv_curs(0, 23); scr_eol(); write(1, "\r", 2); exit(0); } mv_curs(x, y) register int x, y; { char buf[4]; if (x >= Width) { y += x / Width; x = x % Width; } scr_curs(y,x); } getchar() { int c; read(0, &c, 1); return(c&0xff); } read_fil(name) char *name; { register int fd; register char *t, *tmp; char msg[60]; register int cnt; char buf[257]; maknam(msg, name); Low_mem = Cur_ptr; mesg(msg); tmp = Cur_ptr; if ((fd = open(name, 0)) < 0) { mesg("can't open file"); return(-1); } for (;;) { if ((cnt = read(fd, buf, 256)) <= 0) break; buf[cnt] = 0; t = buf; while (t = index(t, '\n')) *t++ = '\r'; if (t_insert(tmp, 0, buf, cnt)) { mesg("file too big"); break; } tmp += cnt; if (cnt != 256) break; } close(fd); return(0); } t_insert(t, len, buf, cnt) char *t, *buf; register int len, cnt; { if (End_buf + (cnt - len) > Mem_buf + Max_mem) return(-1); blockmv(t+cnt, t+len, End_buf-t-len); End_buf += cnt - len; blockmv(t, buf, cnt); return(0); } maknam(buf, nam) char *buf, *nam; { *buf++ = '"'; strcpy(buf, nam); strcat(buf, "\" "); } less.c /************************************************/ /* */ /* LESS Copyright (C) 1990 by Phade Software */ /* */ /************************************************/ #include "less.h" #define EDI "VI" main (argc, argv) int argc; char **argv; { register int c; char *ed; char *getenv(); if (argc != 2) { printf ("\nusage : less file\n\n"); exit (-1); } init(); End_buf = Mem_buf; Cur_ptr = Cur_lp = Mem_buf; *Fil_nam = 0; strcpy(Fil_nam, argv[1]); start_screen(); stats(); for (;;) { set_param(Cur_lp); mv_curs(6, 23); c = getchar(); if (c != '0') c = get_num(c); switch (c) { case 'n': search(1); break; case '/': search(0); break; case 'b': case ' ': case 'd': case 'u': page(c); break; case 'g': goline(); break; case 'q': quit(); break; case 'v': ed = getenv ("EDITOR"); if (ed == 0) execlp (EDI, EDI, Fil_nam, 0); else execlp (ed, ed, Fil_nam, 0); mesg ("can't find editor"); break; default: mesg (""); break; } } }  GL!ƶ!7! ETC/CHILPZPQi,0EQ,0` GL!!7 ETC/CLEARZ X` GL!!7) ETC/FORMATZformatobj1 $1 $2 formatobj2 formatobj1 - GL! !7ETC/FORMATOBJ2Z   ` ! ` K &M L N O 9 M M N N ` J `hh' ``& :!`+L!!'L!!i0L!!8` $%6%JJJJ6% "N$%`)p#%#%**LS!ׅکP$% #! :$Ld!өЭ %iԩѥѮ#% #!#%L! c$%L!%L! %L!"%%%%%L!#% j"#% "ѥ#H#% #!h` \I꽌ɪVɭսɖ0սɖ!ɖ 꽌ɪ\8`꽌ɪɖ۽*ݽ%ݙEۈзЮ꽌ɪФ`7%6%$%\8%$%9%86%7I$%i$%8%8% 8 #K$ :$9% #W$ :$8%н :$$%)* 7%7%` %݌HhHh # # # #V %꩖݌$ %݌ # # # # #`Hh݌`80^݌Hh $ $݌ -$ -$ -$ $ $ $EEHJНh ,$ -$ -$ -$`HJН݌h Hh݌`8`0($ p,&"!%֠Ls$Ԯ#% #L%#% .#ҥҭ"%%%&%8 % %Hh#% j"<ԥ%/8`#% j"#% "ع&%0 &%`%%8`"% %%#% j"%%8` % %$Lh$(0 ( L?ԦʚLeةީa s  lL b,FLg,DL,C0$3 >@ Ɉ 3ɾꩈL(3ɾ;Ƀ B94 l% bʽ  ՚,S` H E8L2C)pJJJJ IH(ȱH:=IH[H`@HcH  $ +   I/H`JLNGȄBȄF aK  haaFF  mJm# KKJ UJ )J ۈ) ;J3ȱJFȱJGJKaȄM  aaNNJFLGJL L? &PRODOS `DaElH$?EGvѶK+`L HHLy XP LM ŠϠĠӠS)*+,+`F)) (*=GJFjJJA QE'+ '== `@ STSP8QSS8 m P o R(8RLnSOS BOOT 1.1 SOS.KERNEL SOS KRNLI/O ERRORFILE 'SOS.KERNEL' NOT FOUND%INVALID KERNEL FILE: xةw,@  ȱlmi8#)!) >dLԡm#i㰼m#iЕOLԡȱfg hi !dLԡ憦  Ljmkm l y`2 Lԡ8(Je稽)ʈ@LBLANK|'   GL! !7ETC/HCZL L[XhihciHHcʎbvuȱbiiȱbiiDiiYi ZUR3bb n$ b碣>bޙץ,,stHʈcbhH ʈpoophMm X RQtPsh`bhHj=i<<=kFfee0  &ߢEX$ƫv` ꥪLYDcbbwyȱbxz`ݥܦL+3UV UwȱUx`wUȥxU`Ncbbȱb`cbbȥb`cbbȱb8塅堅PEncbbȱbeep`0CBe]Q=b`LicbbbE0`Ġ``MMLeڢD ! SL3LH h%LddЉ`?0 HH chh ޥ Yަ`н  eE   .QP$  e LWHhL:5~    eȱeLaL LRwwxȆwxwHw Jhw`w5U,w`,hbhcbwȱbxcȘHH`wȄ w \`fH,Hops8otpf,kiUliVU$f&łmUŁfbUȥcUUŭUVŮMvłGUŁ>UV2ЅUŕȱU喰!UUdUV0*UiUViVUmVnɊȢwU𧰸ХyyUU⥁œ唐=ooppȆbcĂbfUVd8ophLД8= 7MLdlkȄmn;op:E UUȥViлh8HH`Ї{y SՠUEowyywxzzxwIy:eCBЍw U  yUUwyVxz`Зԥwyxz`ywzx`GH o8 UpVUVƠ UVUʆoph3]eУk ЮU 4Г U 5,wЅƩѤ wU! 5Bw0У8 ewwx𴰺 抦5?wtsʆwx8dedЕБt Z Z ,խvqq ", ȹ,ȹ ,W,qewix8 Z Z ,խwqq膸 J즸 , :hhlP,q`h8uhv] :  ڢ hgʆbcb KLf/q ߠ :۩q` S0 L,Hh*Mȱڦhwx%ȱH J h 8e`LԩLcغh8uhHvH` L L L~ 憅 L ʊ8$!  W$Li)$` LY L   hPhQP 8ePQiHHš`hh PȱPʘHH`% 0 L0`,wyywxzzx,Hyw wȄffȪ yw fh0`h&Hwyxzwy wy h Lh` ` ` ` 憅` ` ᥠQP` L L ,-` Leh8PhHQH`hbihciHHb\ȱb]`ߚl hhHHHH`L⥠`ʆ  hdheHdHHHH08  X Xhdhe + eHdHHHeHdH`   q,$` L( L5 LD 8 XL XLR XQHPH RPhPhQ8 XL.0'L+ LfLLLLL ꥪLYԨé    L Hardware configuration       G m $L:L/Slot device of APPLE ][e :    G  $LuLjSlot device of APPLE ][+ : N   G  $LLSlot device of APPLE ][ :     v    a : n  a  k L      G  $L5L-  L?Slot # 8   aLT = P    1  >  T  >  T  >  T  8   G   n   G    n  F G   La  = G n c d i # w  $LL Printer  ` z  $L>L5Joystick/Mouse & ` z  $LiL`Seriell/Parallel O ` z ( $LLModem z ` z  $LLSound-/Speech-card  ` z 1 $LLClock  ` z  $LL Mess storage  ` z O $L&L80 column card  ` z X $LHL?Netcard 7 `LX K `   G   n   G    n   G    n   G   `   G  $LL Floppy ][  `L Mess storage  `Lc @ `@@0L{8<LdLdLdLdL L L L  L  LdL LdLdL L  Ld%Ld*Ld/Ld4Ld9Ld>LdCLdHLdML OL QLdVL XL ZL \L ^LdcL eL gL iL 8L GL!!7 ETC/SETALIASZecho echo "Setting aliases to /TMP..." echo mkdir /tmp/aliases alias unalias 'rm /tmp/aliases/$1' alias ll 'ls -lx $1' alias lockit 'lockme unix' alias online 'ls -l /' alias quota 'df /' alias rmdir 'rm $1' GL!!7 ETC/TTYHIDEZ X ``L%,Tp,Ut,Tt]Li LJL%  i iiL pt%``{ Ɉ.ɕɃ4ɍ6ɉ8ɟ0 NL`ΟLLրLրLրL%,Tp,Ut,T t]Li LJL% i i iLp t%`M PQi,0EQ,0`ȱHh ϩϩ h,,,"" X"`˂̂͂ɀ0`˂˂Lk˂̂̂Lk̂͂͂Lk t RɀL `|8 GL!!7 INCLUDE/DIR.HZ/*************************************************/ /* */ /* DIR.H Copyright (C) 1990 by Phade Software */ /* */ /*************************************************/ #define TXT 4 #define BIN 6 #define DIR 15 #define CMD 240 #define DAT 241 #define PRG 248 #define BAS 252 #define SYS 255 struct dir_file { char *name; /* file name */ int type; /* file type */ long size; /* file size */ long loadadr; /* file load adress */ char flags[4]; /* file flags [0] [1] [2] [3] [4] */ /* d e b w r */ struct dir_file *next; /* next file */ }; GL!!7EINCLUDE/MALLOC.HZ/****************************************************/ /* */ /* MALLOC.H Copyright (C) 1990 by Phade Software */ /* */ /****************************************************/ char *malloc(); char *calloc(); char *realloc(); GL!!7 INCLUDE/SCR.HZ/*************************************************/ /* */ /* SCR.H Copyright (C) 1990 by Phade Software */ /* */ /*************************************************/ /* MAKRO definitions for 80-column-screen */ #define SCR_INV 15 #define SCR_NOR 14 #define SCR_KILL 21 #define SCR_CLEAR 12 #define SCR_HOME 25 #define SCR_SWAP_40 17 #define SCR_SWAP_80 18 GL!!7: SRC/ALIAS.CZ/*************************************************/ /* */ /* ALIAS Copyright (C) 1990 by Phade Software */ /* */ /*************************************************/ /* has to be linked with PH.LIB developed by Phade Software */ #include #include char *ALIASPATH; print_alias (adir) struct dir_file *adir; { FILE *fd; char fname[64]; char buf[256]; if (adir->next) { strcpy (fname, ALIASPATH); strcat (fname, adir->name); fd = fopen (fname, "r"); fgets (buf, 256, fd); fclose (fd); strtolow (adir->name); printf ("%-17s", adir->name); printf ("%s", buf); free (fname); free (buf); print_alias (adir->next); } } main (argc, argv) int argc; char *argv[]; { FILE *fd; char fname[64]; int c; char *getenv(); ALIASPATH = getenv ("ALIASPATH"); if (ALIASPATH == 0) { printf ("\nalias: environment variable ALIASPATH is missing\n\n"); exit (-1); } if (argc == 1) { printf ("\n"); print_alias (get_dir (ALIASPATH)); printf ("\n"); exit (0); } if (argc != 3) { printf ("\nusage: alias [name 'def ...']\n\n"); exit (-1); } if (strlen (argv[1]) > 15) { printf ("\nalias: aliasname to long\n\n"); exit (-1); } strcpy (fname, ALIASPATH); strcat (fname, argv[1]); fd = fopen (fname, "w"); if (fd == 0) { printf ("\nalias: can't open \"%s\" !\n\n", fname); exit (-1); } fputs (argv[2], fd); fputc ((char)0x0d, fd); fclose (fd); printf ("alias: %-17s ", argv[1]); printf ("%s\n", argv[2]); exit (0); } GL! !7  SRC/BANNER.CZ/**************************************************/ /* */ /* BANNER Copyright (C) 1990 by Phade Software */ /* */ /**************************************************/ /* has to be linked with PH.LIB developed by Phade Software */ /* cc -Z3000 banner.c */ /* ln banner.o -lph -lc */ #include #define EM "" char *al[] = { " * | * * |* * |***** |* * |* * |", /* A */ "**** |* * |**** |* * |* * |**** |", /* B */ " *** |* * |* |* |* * | *** |", /* C */ "**** |* * |* * |* * |* * |**** |", /* D */ "***** |* |**** |* |* |***** |", /* E */ "***** |* |**** |* |* |* |", /* F */ " *** |* * |* |* ** |* * | *** |", /* G */ "* * |* * |***** |* * |* * |* * |", /* H */ " *** | * | * | * | * | *** |", /* I */ " *** | * | * | * |* * | ** |", /* J */ "* * |* * |*** |* * |* * |* * |", /* K */ "* |* |* |* |* |***** |", /* L */ "* * |** ** |* * * |* * |* * |* * |", /* M */ "* * |** * |* * * |* * * |* ** |* * |", /* N */ " *** |* * |* * |* * |* * | *** |", /* O */ "**** |* * |**** |* |* |* |", /* P */ " *** |* * |* * |* * * |* * | ** * |", /* Q */ "**** |* * |**** |* * |* * |* * |", /* R */ " *** |* | *** | * |* * | *** |", /* S */ "***** | * | * | * | * | * |", /* T */ "* * |* * |* * |* * |* * | *** |", /* U */ "* * |* * |* * |* * | * * | * |", /* V */ "* * |* * |* * |* * * |** ** |* * |", /* W */ "* * | * * | * | * * |* * |* * |", /* X */ "* * | * * | * | * | * | * |", /* Y */ "***** | * | * | * |* |***** |", /* Z */ " | | | | | |", /* */ " | | | | ** | ** |", /* . */ " *** |* ** |* * * |* * * |** * | *** |", /* 0 */ " * | ** |* * | * | * | *** |", /* 1 */ " *** |* * | * | * | * |***** |", /* 2 */ " *** |* * | ** | * |* * | *** |", /* 3 */ " * | ** | * * |***** | * | * |", /* 4 */ "***** |* |**** | * |* * | *** |", /* 5 */ " *** |* * |* |**** |* * | *** |", /* 6 */ "***** | * | * | * | * | * |", /* 7 */ " *** |* * | *** |* * |* * | *** |", /* 8 */ " *** |* * | **** | * |* * | *** |", /* 9 */ " * | * | * | * | * |* |", /* / */ " *** |* * |* * * |* * |* | *** |" /* @ */ }; char c[] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N', 'O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','.', '0','1','2','3','4','5','6','7','8','9','/','@',']' }; print_banner (str) char *str; { int len; int i; int count; char ch; char t; char buf[80]; char buf1[80]; char buf2[80]; char buf3[80]; char buf4[80]; char buf5[80]; char buf6[80]; strcpy (buf1, EM); strcpy (buf2, EM); strcpy (buf3, EM); strcpy (buf4, EM); strcpy (buf5, EM); strcpy (buf6, EM); len = strlen (str); if (len>12) str[12] = '\0'; len = strlen (str); for (i=0; i #include int count; long used; int ttype (type, makro, text) int type; int makro; char *text; { if (type != makro) return (0); printf ("%s ", text); return (1); } printtype (type) int type; { if (ttype (type, TXT, "TXT")) return; if (ttype (type, BIN, "BIN")) return; if (ttype (type, DIR, "DIR")) return; if (ttype (type, CMD, "CMD")) return; if (ttype (type, DAT, "DAT")) return; if (ttype (type, PRG, "PRG")) return; if (ttype (type, BAS, "BAS")) return; if (ttype (type, SYS, "SYS")) return; printf ("??? "); } print_dir (di) struct dir_file *di; { int i; if (di->next) { count++; if (di->flags[3]) printf (" "); else printf ("*"); printf ("%-15s ", di->name); printtype (di->type); printf ("A=$%04x ", di->loadadr); printf ("L=%-5ld\n", di->size); used = used + di->size; print_dir (di->next); } } printdir (di, name) struct dir_file *di; char *name; { char *rname; int i; strtoup (name); fixnam (name, rname); printf ("\nPath: %s\n\n", rname); print_dir (di); } main (argc, argv) int argc; char *argv[]; { char name[64]; count = 0; used = 0; if (argc == 1) { if (getprefix (name) == -1) { printf ("\ndir: error while getting prefix\n\n"); exit (-1); } printdir (get_dir (name), name); } if (argc == 2) printdir (get_dir (argv[1]), argv[1]); if (count > 0) printf ("\n%d files using %ld bytes\n\n", count, used); exit (0); } GL!!7 SRC/DUMP.CZ/************************************************/ /* */ /* DUMP Copyright (C) 1990 by Phade Software */ /* */ /************************************************/ #include FILE *fd; long filepos; unsigned char Byte[100], CTable[256]; int i, w, ok; printc (c) int c; { #asm SP EQU $02 ldy #$0b lda (SP),Y adc #$80 jsr $fded #endasm; } printh (h) int h; { #asm SB EQU $02 ldy #$0b lda (SB),Y jsr $fdda lda #$a0 jsr $fded #endasm; } int readbytes () { register int i, z = 0; for (i=0; ienv; while (*cp) { printf ("%s\n", cp); cp += strlen (cp) + 1; } return (); } main (argc, argv) int argc; char *argv[]; { char *env; char *getenv (); if ((argc != 1) && (argc != 2)) { printf ("\nusage: env [variable]\n\n"); exit (-1); } printf ("\n%c SHELL - ENVIRONMENT %c\n\n", (char)15, (char)14); if (argc == 2) { env = getenv (argv[1]); if (env == 0) { printf ("env: not in environment\n\n"); exit (-1); } else printf ("%s = %s\n", argv[1], env); } else printenv(); printf ("\n"); exit (0); } GL!!7 SRC/FCOUNT.CZ /**************************************************/ /* */ /* FCOUNT Copyright (C) 1990 by Phade Software */ /* */ /**************************************************/ #include #include #include #define empty "" struct dir { char length; /* entry_name length */ char name[15]; /* entry_name */ char type; /* entry_type */ char fil[22]; /* not used bytes */ }; int nosubs; int dircount; int poke () { #asm lda #$00 sta $057B #endasm; } int makepoint () { poke (); if (dircount == 0) printf ("\\"); if (dircount == 1) printf ("|"); if (dircount == 2) printf ("/"); if (dircount == 3) { printf ("-"); dircount = 0; } else dircount++; } int fcount (path) char *path; { struct dir *entry = (struct dir *)malloc (sizeof (struct dir)); char header[43]; char *newpath = malloc (64); int fd; int nbytes; int count = 1; int num = 0; makepoint (); if ((fd = open (path, O_RDONLY, 0)) < 0) { poke (); return (-1); } makepoint (); nbytes = read (fd, header, 43); makepoint (); if (nbytes < 43) { close (fd); free (entry); free (newpath); poke (); return (0); } while (0 == 0) { makepoint (); nbytes = read (fd, entry, 39); makepoint (); if (nbytes < 39) { close (fd); free (entry); free (newpath); poke (); return (num); } if (++count == 13) { read (fd, header, 5); count = 0; } while (entry->length > 15) entry->length = entry->length - 16; if (entry->type == 0) { close (fd); free (entry); free (newpath); poke (); return (num); } if (entry->length != 0) { if ((entry->type == (char)15) && (!nosubs)) { strcpy (newpath, path); strcat (newpath, "/"); strncat (newpath, entry->name, entry->length); num = num + fcount (newpath); } num = num + 1; } } } main (argc, argv) int argc; char *argv[]; { char *curpath = malloc (64); char *path = malloc (64); dircount = 0; nosubs = 0; if (argc > 3) { printf ("\n"); printf ("usage : fcount [-option] [path]\n\n"); printf ("option : [-n] = counting without subdirectory\n"); printf ("\n"); exit (-1); } if (*argv[1] == '-') { switch (*++argv[1]) { case 'n' : nosubs = 1; break; default : break; } } if (((argc == 1) && (!nosubs)) || ((argc == 2) && (nosubs))) { if (getprefix (path) == -1) errexit (); if (strlen (path) < 2) exit (0); strcpy (curpath, empty); strncat (curpath, path, strlen (path) - 1); printf (" \n%d files\n\n" ,fcount (curpath)); } else if (nosubs) printf (" \n%d files\n\n", fcount (argv[2])); else printf (" \n%d files\n\n", fcount (argv[1])); exit (0); } errexit () { perror ("fcount "); exit (-1); } GL!!7 SRC/FIND.CZ /************************************************/ /* */ /* FIND Copyright (C) 1990 by Phade Software */ /* */ /************************************************/ /* has to be linked with PH.LIB developed by Phade Software */ #include #include #include struct dir { char length; /* entry_name length */ char name[15]; /* entry_name */ char type; /* entry_type */ char fil[22]; /* not used bytes */ }; int silent; int dircount; int found; int poke () { #asm lda #$00 sta $057B #endasm; } int makepoint () { if (silent == 1) return (); poke (); if (dircount == 0) printf ("\\"); if (dircount == 1) printf ("|"); if (dircount == 2) printf ("/"); if (dircount == 3) { printf ("-"); dircount = 0; } else dircount++; } int find (path, name) char *path; char *name; { struct dir *entry = (struct dir *)malloc (sizeof (struct dir)); char header[43]; char newpath[64]; int fd; int nbytes; int count = 1; makepoint(); if (setprefix (path) == -1) errexit (); makepoint(); if ((fd = open (name, O_RDONLY, 0)) < 0); else { close (fd); poke (); if (found) { poke (); if (silent == 0) printf ("found in %s\n", path); } else if (silent == 0) printf (" \nfound in %s\n", path); found = 1; } if ((fd = open (path, O_RDONLY, 0)) < 0) return (-1); makepoint(); nbytes = read (fd, header, 43); makepoint(); if (nbytes < 43) { close (fd); free (entry); return (-1); } while (0 == 0) { makepoint(); nbytes = read (fd, entry, 39); makepoint(); if (nbytes < 39) { close (fd); free (entry); return (0); } makepoint(); if (++count == 13) { read (fd, header, 5); count = 0; } while (entry->length > 15) entry->length = entry->length - 16; if (entry->type == 0) { close (fd); free (entry); return (0); } if (entry->length != 0) { if (entry->type == (char)15) { strcpy (newpath, path); strcat (newpath, "/"); strncat (newpath, entry->name, entry->length); find (newpath, name); } } } } main (argc, argv) int argc; char *argv[]; { char curpath[64]; int argfound = 0; int reverse = 0; silent = 0; dircount = 0; found = 0; if ((argc < 2) || (argc > 4)) { printf ("\n"); printf ("usage : find [-option] [path] file\n"); printf ("\n"); printf ("option : [-s] = silent\n"); printf (" [-S] = silent and returns -1 if found\n"); printf ("\n"); exit (-1); } if (getprefix (curpath) == -1) errexit (); if (*argv[1] == '-') { argfound = 1; switch (*++argv[1]) { case 's' : silent = 1; break; case 'S' : silent = 1; reverse = 1; break; default : break; } } if ((argc == 2) && (argfound == 0)) find (curpath, argv[1]); if ((argc == 3) && (argfound == 1)) find (curpath, argv[2]); if ((argc == 3) && (argfound == 0)) { strtoup (argv[1]); find (argv[1], argv[2]); } if ((argc == 4) && (argfound == 1)) { strtoup (argv[2]); find (argv[2], argv[3]); } if (setprefix (curpath) == -1) errexit (); poke (); if ((found) && (silent == 0)) printf (" \n"); else if (silent == 0) printf (" \nfind: not found\n\n"); if ((!found) && (silent) && (!reverse)) exit (-1); if ((found) && (silent) && (reverse)) exit (-1); exit (0); } errexit () { poke (); printf (" \n"); perror ("find"); printf ("\n"); exit (-1); } GL!!77SRC/FORMATOBJ1.CZ /******************************************************/ /* */ /* FORMATOBJ1 Copyright (C) 1990 by Phade Software */ /* */ /******************************************************/ #include set (value) { #asm instxt ldy #$0B lda (SP),Y sta $07FF #endasm } int get () { #asm ldy $07FF sty R0 ldy #$00 sty R0+1 #endasm } main (argc, argv) int argc; char *argv[]; { int slot; int drive; int value; int rr; rr = get (); if ((argc == 2) && (rr == 39)) printf ("error: unable to format\n\n"); if ((argc == 2) && (rr == 43)) printf ("error: write-protected\n\n"); if ((argc == 2) && (rr == 51)) printf ("error: drive to slow\n\n"); if ((argc == 2) && (rr == 52)) printf ("error: drive to fast\n\n"); if ((argc == 2) && (rr == 0)) printf ("format completed\n\n"); if (argc == 2) exit (-1); if (argc != 3) { printf ("\nusage: format slot drive\n\n"); exit (-1); } slot = atoi (argv[1]); drive = atoi (argv[2]); if ((slot < 1) || (slot > 7) || (drive < 1) || (drive > 2)) { printf ("\nformat: bad values\n\n"); exit (-1); } value = slot * 16 + 128 * (drive - 1); set (value); printf ("\nformatting disk in Slot: %d Drive: %d to /BLANK\n\n" , slot, drive); exit (0); } GL!!7X SRC/LOCKME.CZ /**************************************************/ /* */ /* LOCKME Copyright (C) 1990 by Phade Software */ /* */ /**************************************************/ /* has to be linked with PH.LIB developed by Phade Software */ #include set_reset () { #asm instxt lda #$0 sta $3f2 lda #$08 sta $3f3 jsr $fb6f jsr $c300 jsr $fc58 #endasm; } start () { qprintf (" wrong password"); chilp (); #asm jmp $800 #endasm; } main (argc, argv) int argc; char *argv[]; { char keyword[80]; int key; int i=0; if (argc != 2) { printf ("\nusage: lockme password\n\n"); exit (-1); } set_reset (); #asm lda #$0f jsr $fded #endasm; qprintf (" LOCKME "); #asm lda #$0e jsr $fded lda #$0d jsr $fded jsr $fded #endasm; while ((key = get_char ()) != 141) { key = key - 128; keyword[i] = key; i++; if (i == 80) start (); qprintf ("."); } if (strlen (argv[1]) != i) start (); if (strncmp (keyword, argv[1], i)) start (); printf ("\n\n"); exit (0); } GL!!7 SRC/MORE.CZ /************************************************/ /* */ /* MORE Copyright (C) 1990 by Phade Software */ /* */ /************************************************/ /* has to be linked with PH.LIB developed by Phade Software */ #include #define INV 15 #define NOR 14 #define EDI "VI" int signal; front () { #asm lda #$0 sta $57b #endasm; } more () { int c; front (); printf ("%c more %c", INV, NOR); c = get_char (); if ((c == 209) || (c == 241)) signal = 1; if (c == 246) signal = 2; front (); printf (" "); front (); } printit (fd, filename) FILE *fd; char *filename; { char buf[256]; int line; line = 0; while (fgets (buf, 256, fd)) { if (feof (fd)) break; front (); qprintf (buf); line++; if (line == 23) { more (); if (signal == 1) break; if (signal == 2) break; line = 0; } } printf ("\n"); free (buf); } main (argc,argv) int argc; char *argv[]; { FILE *fd; char *ed; char *getenv(); int err; if (argc != 2) { printf ("\nusage : more file\n\n"); exit (-1); } fd = fopen (argv[1], "r"); if (fd == 0) { printf ("\nmore: can't open \"%s\" !\n\n", argv[1]); exit (-1); } signal = 0; printit (fd, argv[1]); fclose (fd); if (signal == 2) { ed = getenv ("EDITOR"); if (ed == 0) err = execlp (EDI, EDI, argv[1], 0); else err = execlp (ed, ed, argv[1], 0); if (err = -1) printf ("\nmore: can't start editor\n\n"); } exit (0); } GL!!7  SRC/MVVOL.CZ/*************************************************/ /* */ /* MVVOL Copyright (C) 1990 by Phade Software */ /* */ /*************************************************/ #include main (argc, argv) int argc; char *argv[]; { if (argc != 3) { printf ("\nusage: mvvol sourcevolume targetvolume\n\n"); exit (-1); } if (rename (argv[1], argv[2]) == -1) { printf ("\nmvvol error\n\n"); exit (-1); } exit (0); } GL!!7 SRC/PASS.CZ/************************************************/ /* */ /* PASS Copyright (C) 1990 by Phade Software */ /* */ /************************************************/ #define w 5000 #include FILE *fd1, *fd2; int Byte[w]; int i, pass, pass1, pass2, ok; int readit() { int i; int z=0; for (i=1; i 255) Byte[i] = Byte[i] - 256; Byte[i] = Byte[i] + pass1; if (Byte[i] > 255) Byte[i] = Byte[i] - 256; Byte[i] = Byte[i] + pass2; if (Byte[i] > 255) Byte[i] = Byte[i] - 256; fputc (Byte[i], fd2); } if (feof (fd1)) break; } } rebuild () { int i; while ((ok = readit()) != 0) { for (i=1; i 255) Byte[i] = Byte[i] + 256; Byte[i] = Byte[i] - pass1; if (Byte[i] > 255) Byte[i] = Byte[i] + 256; Byte[i] = Byte[i] - pass2; if (Byte[i] > 255) Byte[i] = Byte[i] + 256; fputc (Byte[i], fd2); } if (feof (fd1)) break; } } print () { int i; while ((ok = readit()) != 0) { for (i=1; i 255) Byte[i] = Byte[i] + 256; Byte[i] = Byte[i] - pass1; if (Byte[i] > 255) Byte[i] = Byte[i] + 256; Byte[i] = Byte[i] - pass2; if (Byte[i] > 255) Byte[i] = Byte[i] + 256; printf ("%c", Byte[i]); } if (feof (fd1)) break; } } GL! !72 SRC/REM.CZ/***********************************************/ /* */ /* REM Copyright (C) 1990 by Phade Software */ /* */ /***********************************************/ #include FILE *fd1, *fd2; int Byte; int i = 0; int lasti = 0; int Byte1, Byte2, ok; int readit() { if (feof (fd1)) return (0); Byte = fgetc (fd1); return (1); } main (argc, argv) int argc; char *argv[]; { int code = 0; printf ("\n"); if (argc != 4) { printf ("usage : rem option source target\n"); printf ("\n"); printf ("options : [-c] = C-Source /* rem */\n"); printf (" [-k] = Kyan-Source (* rem *)\n"); printf (" [-p] = Pascal-Source { rem }\n\n"); exit (-1); } fd1 = fopen (argv[2],"r"); if (fd1 == 0L) { printf ("Can't open %s !\n\n",argv[2]); exit (-1); } fd2 = fopen (argv[3],"w"); if (fd2 == 0L) { printf ("Can't open %s !\n\n",argv[3]); fclose (fd1); exit (-1); } if (*argv[1] == '-') switch (*++argv[1]) { case 'c': csource(); break; case 'k': ksource(); break; case 'p': psource(); break; default: printf ("Wrong option specified.\n\n"); code = -1; break; } else { printf ("No option specified.\n\n"); code = -1; } CloseIt (code); } csource () { int stop = 1; int marker = 0; if ((ok = readit ()) == 1) Byte2 = Byte; else { printf ("C-rem's are removed.\n\n"); CloseIt (0); } while (stop == 1) { if ((ok = readit()) == 1) Byte1 = Byte; else { if (lasti != 0) printf ("\n\n"); printf ("C-rem's are removed.\n\n"); CloseIt (0); } if (marker == 3) marker = 0; else { if ((Byte2 == '/') && (Byte1 == '*') && (marker == 0)) { marker = 2; i = i + 2; } if ((Byte2 == '*') && (Byte1 == '/') && (marker == 2)) { marker = 3; i = i + 2; } if (marker == 0) fputc (Byte2, fd2); if (marker == 2) i = i + 1; } if ((i/50 >= lasti) && (i/50 != lasti)) { if (lasti == 0) printf ("Each dot is 50 Byte to remove.\n\n"); printf ("."); lasti = i/50; } Byte2 = Byte1; } } ksource () { int stop = 1; int marker = 0; if ((ok = readit ()) == 1) Byte2 = Byte; else { printf ("Kyan-rem's are removed.\n\n"); CloseIt (0); } while (stop == 1) { if ((ok = readit()) == 1) Byte1 = Byte; else { if (lasti != 0) printf ("\n\n"); printf ("Kyan-rem's are removed.\n\n"); CloseIt (0); } if (marker == 3) marker = 0; else { if ((Byte2 == '(') && (Byte1 == '*') && (marker == 0)) { marker = 2; i = i + 2; } if ((Byte2 == '*') && (Byte1 == ')') && (marker == 2)) { marker = 3; i = i + 2; } if (marker == 0) fputc (Byte2, fd2); if (marker == 2) i = i + 1; } if ((i/50 >= lasti) && (i/50 != lasti)) { if (lasti == 0) printf ("Each dot is 50 Byte to remove.\n\n"); printf ("."); lasti = i/50; } Byte2 = Byte1; } } psource () { int marker = 0; int last = 0; while (1) { ok = readit (); if (feof (fd1)) { if (lasti != 0) printf ("\n\n"); printf ("Pascal-rem's are removed.\n\n"); CloseIt (0); } if ((Byte == '}') && (marker == 1)) { marker = 0; last = 1; } if ((Byte == '{') && (marker == 0)) marker = 1; if ((marker == 0) && (last == 0)) fputc (Byte, fd2); if (marker != 0) i = i + 1; if ((i/50 >= lasti) && (i/50 != lasti)) { if (lasti == 0) printf ("Each dot is 50 Byte to remove.\n\n"); printf ("."); lasti = i/50; } last = 0; } } CloseIt (code) int code; { fclose (fd1); fclose (fd2); exit (code); } GL!!7 SRC/SORT.CZ/************************************************/ /* */ /* SORT Copyright (C) 1990 by Phade Software */ /* */ /************************************************/ #include #include #define MAXLINES 500 char *lines[MAXLINES]; int cmp (a, b) char **a, **b; { return strcmp (*a, *b); } main() { int i; int numlines; char buf[80]; for (numlines=0; numlines #include #include #define empty "" struct dir { char length; /* entry_name length */ char name[15]; /* entry_name */ char type; /* entry_type */ char fil[22]; /* not used bytes */ }; int tree (path, subs) char *path; int subs; { struct dir *entry = (struct dir *)malloc (sizeof (struct dir)); char header[43]; char newpath[64]; int fd; int nbytes; int count = 1; int i; for (i=0;ilength > 15) entry->length = entry->length - 16; if (entry->type == 0) { close (fd); free (entry); free (newpath); return (0); } if (entry->length != 0) { if (entry->type == (char)15) { strcpy (newpath, path); strcat (newpath, "/"); strncat (newpath, entry->name, entry->length); tree (newpath, subs + 1); } } } } main (argc, argv) int argc; char *argv[]; { char curpath[64]; char path[64]; if (argc > 2) { printf ("\nusage : subs [path]\n\n"); exit (-1); } if (argc == 1) { if (getprefix (path) == -1) errexit (); if (strlen (path) < 2) exit (0); strcpy (curpath, empty); strncat (curpath, path, strlen (path) - 1); printf ("\nDirectory-tree at %s :\n\n", curpath); tree (curpath, 0); } else { strtoup (argv[1]); printf ("\nDirectory-tree at %s :\n\n", argv[1]); tree (argv[1], 0); } printf ("\n"); exit (0); } errexit () { perror ("tree "); exit (-1); } GL!!7H SRC/SYSERR.CZ/**************************************************/ /* */ /* SYSERR Copyright (C) 1990 by Phade Software */ /* */ /**************************************************/ #define MAXERR 0x5a struct errlist { int code; char *msg; } errlist[] = { 0x00, "No error", 0x01, "Invalid number for system call", 0x04, "Invalid param count for system call", 0x25, "Interrupt vector table full", 0x27, "I/O Error", 0x28, "No device connected/detected", 0x2b, "Disk write protected", 0x2e, "Disk switched", 0x40, "Invalid characters in pathname", 0x42, "File control block table full", 0x43, "Invalid reference number", 0x44, "Path not found", 0x45, "Volume directory not found", 0x46, "File not found", 0x47, "Duplicate file name", 0x48, "Overrun error", 0x49, "Volume table full", 0x4a, "Incompatible file format", 0x4b, "Unsupported storage type", 0x4c, "End of file encountered", 0x4d, "Position out of range", 0x4e, "Access error", 0x50, "File is open", 0x51, "Directory count error", 0x52, "Not a ProDOS disk", 0x53, "Invalid parameter", 0x55, "Volume control block table full", 0x56, "Bad buffer address", 0x57, "Duplicate volume", 0x5a, "Invalid address in bit map", -1, "Unknown Error Code" }; main () { register struct errlist *sp; int i; printf ("\n%c SYSERR %c\n\n", (char)15, (char)14); for (i=0; icode>=0;sp++) if (sp->code == i) break; if (sp->code != -1) printf ("%2d : %s\n", i, sp->msg); } printf ("\n"); exit (0); } GL!!7SRC/TD.CZ/**********************************************/ /* */ /* TD Copyright (C) 1990 by Phade Software */ /* */ /**********************************************/ #include #include char *day[] = {"Sun","Mon","Tues","Wends","Thurs","Fri","Satur"}; char *mon[] = {"Januar","Februar","March","April","Mai","June", "July","August","September","October","November","December"}; main() { struct tm *tm; long t=time(); tm = localtime(&t); printf ("\nTime: %02d:%02d:%02d Date: %sday %02d %s 19%02d\n\n", tm->tm_hour,tm->tm_min,tm->tm_sec, day[tm->tm_wday],tm->tm_mday,mon[tm->tm_mon],tm->tm_year); exit (0); } GL!!7s SRC/TREE.CZ/************************************************/ /* */ /* TREE Copyright (C) 1990 by Phade Software */ /* */ /************************************************/ /* has to be linked with PH.LIB developed by Phade Software */ #include #include #include #define empty "" struct dir { char length; /* entry_name length */ char name[15]; /* entry_name */ char type; /* entry_type */ char fil[22]; /* not used bytes */ }; int tree (path, subs) char *path; int subs; { struct dir *entry = (struct dir *)malloc (sizeof (struct dir)); char header[43]; char newpath[64]; char filename[16]; int fd; int nbytes; int count = 1; int i; for (i=0;ilength > 15) entry->length = entry->length - 16; if (entry->type == 0) { close (fd); free (entry); free (newpath); free (filename); return (0); } if (entry->length != 0) { if (entry->type == (char)15) { strcpy (newpath, path); strcat (newpath, "/"); strncat (newpath, entry->name, entry->length); tree (newpath, subs + 1); } else { for (i=0;iname, entry->length); printf (" %s\n", filename); } } } } main (argc, argv) int argc; char *argv[]; { char curpath[64]; char path[64]; if (argc > 2) { printf ("\nusage : tree [path]\n\n"); exit (-1); } if (argc == 1) { if (getprefix (path) == -1) errexit (); if (strlen (path) < 2) exit (0); strcpy (curpath, empty); strncat (curpath, path, strlen (path) - 1); printf ("\nDirectory-tree at %s :\n\n", curpath); tree (curpath, 0); } else { strtoup (argv[1]); printf ("\nDirectory-tree at %s :\n\n", argv[1]); tree (argv[1], 0); } printf ("\n"); exit (0); } errexit () { perror ("tree "); exit (-1); } GL!!7 SRC/TTYHIDE.CZ/***************************************************/ /* */ /* TTYHIDE Copyright (C) 1990 by Phade Software */ /* */ /***************************************************/ #include #include main() { printf ("%c\n",(char)26); waitkey (); #asm lda #$0 sta $C010 #endasm exit (0); }